@tangle-network/agent-bench 1.0.2 → 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.
Files changed (222) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +24 -2
  3. package/dist/adapters.d.ts +3 -3
  4. package/dist/adapters.js +3 -5
  5. package/dist/adapters.js.map +1 -1
  6. package/dist/benchmarks/_harness.d.ts +4 -4
  7. package/dist/benchmarks/_harness.js +5 -2
  8. package/dist/benchmarks/_harness.js.map +1 -1
  9. package/dist/benchmarks/aec-bench.d.ts +2 -2
  10. package/dist/benchmarks/aec-bench.js +49 -42
  11. package/dist/benchmarks/aec-bench.js.map +1 -1
  12. package/dist/benchmarks/agentbench.d.ts +2 -2
  13. package/dist/benchmarks/agentbench.js +41 -34
  14. package/dist/benchmarks/agentbench.js.map +1 -1
  15. package/dist/benchmarks/appworld.d.ts +4 -4
  16. package/dist/benchmarks/appworld.js +67 -53
  17. package/dist/benchmarks/appworld.js.map +1 -1
  18. package/dist/benchmarks/bfcl.d.ts +2 -2
  19. package/dist/benchmarks/bfcl.js +52 -44
  20. package/dist/benchmarks/bfcl.js.map +1 -1
  21. package/dist/benchmarks/cad-design.d.ts +2 -2
  22. package/dist/benchmarks/cad-design.js +53 -44
  23. package/dist/benchmarks/cad-design.js.map +1 -1
  24. package/dist/benchmarks/cadbench.d.ts +2 -2
  25. package/dist/benchmarks/cadbench.js +1 -1
  26. package/dist/benchmarks/cadgenbench.d.ts +2 -2
  27. package/dist/benchmarks/cadgenbench.js +1 -1
  28. package/dist/benchmarks/commit0.d.ts +2 -2
  29. package/dist/benchmarks/commit0.js +38 -31
  30. package/dist/benchmarks/commit0.js.map +1 -1
  31. package/dist/benchmarks/crag.d.ts +2 -2
  32. package/dist/benchmarks/crag.js +37 -32
  33. package/dist/benchmarks/crag.js.map +1 -1
  34. package/dist/benchmarks/dabstep.d.ts +2 -2
  35. package/dist/benchmarks/dabstep.js +41 -34
  36. package/dist/benchmarks/dabstep.js.map +1 -1
  37. package/dist/benchmarks/finresearchbench.d.ts +4 -4
  38. package/dist/benchmarks/finresearchbench.js +63 -50
  39. package/dist/benchmarks/finresearchbench.js.map +1 -1
  40. package/dist/benchmarks/finsearchcomp.d.ts +3 -3
  41. package/dist/benchmarks/finsearchcomp.js +55 -44
  42. package/dist/benchmarks/finsearchcomp.js.map +1 -1
  43. package/dist/benchmarks/frames.d.ts +2 -2
  44. package/dist/benchmarks/frames.js +66 -51
  45. package/dist/benchmarks/frames.js.map +1 -1
  46. package/dist/benchmarks/hotpotqa.d.ts +2 -2
  47. package/dist/benchmarks/hotpotqa.js +59 -47
  48. package/dist/benchmarks/hotpotqa.js.map +1 -1
  49. package/dist/benchmarks/humaneval.d.ts +3 -3
  50. package/dist/benchmarks/humaneval.js +39 -35
  51. package/dist/benchmarks/humaneval.js.map +1 -1
  52. package/dist/benchmarks/mcad-bench.d.ts +2 -2
  53. package/dist/benchmarks/mcad-bench.js +68 -56
  54. package/dist/benchmarks/mcad-bench.js.map +1 -1
  55. package/dist/benchmarks/mcad-cq-bench.d.ts +3 -3
  56. package/dist/benchmarks/mcad-cq-bench.js +70 -58
  57. package/dist/benchmarks/mcad-cq-bench.js.map +1 -1
  58. package/dist/benchmarks/mcad-cq-golds.d.ts +1 -1
  59. package/dist/benchmarks/mcad-cq-golds.js +1 -1
  60. package/dist/benchmarks/mcad-cq-golds.js.map +1 -1
  61. package/dist/benchmarks/mcad-golds.d.ts +1 -1
  62. package/dist/benchmarks/mcad-golds.js.map +1 -1
  63. package/dist/benchmarks/mind2web.d.ts +3 -3
  64. package/dist/benchmarks/mind2web.js +62 -49
  65. package/dist/benchmarks/mind2web.js.map +1 -1
  66. package/dist/benchmarks/nomiracl.d.ts +2 -2
  67. package/dist/benchmarks/nomiracl.js +43 -36
  68. package/dist/benchmarks/nomiracl.js.map +1 -1
  69. package/dist/benchmarks/open-rag-bench.d.ts +2 -2
  70. package/dist/benchmarks/open-rag-bench.js +37 -32
  71. package/dist/benchmarks/open-rag-bench.js.map +1 -1
  72. package/dist/benchmarks/programbench.d.ts +2 -2
  73. package/dist/benchmarks/programbench.js +28 -23
  74. package/dist/benchmarks/programbench.js.map +1 -1
  75. package/dist/benchmarks/rag-shared.d.ts +2 -2
  76. package/dist/benchmarks/rag-shared.js +15 -13
  77. package/dist/benchmarks/rag-shared.js.map +1 -1
  78. package/dist/benchmarks/ragbench.d.ts +2 -2
  79. package/dist/benchmarks/ragbench.js +34 -29
  80. package/dist/benchmarks/ragbench.js.map +1 -1
  81. package/dist/benchmarks/simpleqa.d.ts +2 -2
  82. package/dist/benchmarks/simpleqa.js +63 -52
  83. package/dist/benchmarks/simpleqa.js.map +1 -1
  84. package/dist/benchmarks/swe-bench.d.ts +4 -4
  85. package/dist/benchmarks/swe-bench.js +47 -41
  86. package/dist/benchmarks/swe-bench.js.map +1 -1
  87. package/dist/benchmarks/t2-ragbench.d.ts +2 -2
  88. package/dist/benchmarks/t2-ragbench.js +37 -32
  89. package/dist/benchmarks/t2-ragbench.js.map +1 -1
  90. package/dist/benchmarks/tau-bench-shared.d.ts +2 -2
  91. package/dist/benchmarks/tau-bench-shared.js +43 -36
  92. package/dist/benchmarks/tau-bench-shared.js.map +1 -1
  93. package/dist/benchmarks/tau2-bench.d.ts +2 -2
  94. package/dist/benchmarks/tau2-bench.js.map +1 -1
  95. package/dist/benchmarks/tau3-banking.d.ts +2 -2
  96. package/dist/benchmarks/tau3-banking.js.map +1 -1
  97. package/dist/benchmarks/terminal-bench.d.ts +2 -2
  98. package/dist/benchmarks/terminal-bench.js +29 -23
  99. package/dist/benchmarks/terminal-bench.js.map +1 -1
  100. package/dist/benchmarks/toollm.d.ts +2 -2
  101. package/dist/benchmarks/toollm.js +40 -34
  102. package/dist/benchmarks/toollm.js.map +1 -1
  103. package/dist/benchmarks/trata-hedge.d.ts +2 -2
  104. package/dist/benchmarks/trata-hedge.js +49 -43
  105. package/dist/benchmarks/trata-hedge.js.map +1 -1
  106. package/dist/benchmarks/types.d.ts +33 -63
  107. package/dist/benchmarks/types.js +36 -1
  108. package/dist/benchmarks/types.js.map +1 -0
  109. package/dist/benchmarks/webarena-verified.d.ts +2 -2
  110. package/dist/benchmarks/webarena-verified.js +29 -24
  111. package/dist/benchmarks/webarena-verified.js.map +1 -1
  112. package/dist/{cadbench-DhAndllg.js → cadbench-htzAmMaI.js} +41 -36
  113. package/dist/cadbench-htzAmMaI.js.map +1 -0
  114. package/dist/{cadgenbench-Tvk16YKT.js → cadgenbench-BLvEtnxU.js} +28 -22
  115. package/dist/cadgenbench-BLvEtnxU.js.map +1 -0
  116. package/dist/cli.d.ts +1 -0
  117. package/dist/cli.js +667 -0
  118. package/dist/cli.js.map +1 -0
  119. package/dist/index.d.ts +11 -10
  120. package/dist/index.js +64 -59
  121. package/dist/index.js.map +1 -1
  122. package/package.json +9 -6
  123. package/scripts/enterpriseops-gym-run.sh +82 -0
  124. package/scripts/grade-recorded-evidence.mjs +50 -0
  125. package/scripts/harvey-lab-judge.py +50 -0
  126. package/scripts/harvey-lab-run.sh +53 -0
  127. package/scripts/harvey-lab-sandbox.sh +21 -0
  128. package/scripts/healthbench-professional-run.sh +30 -0
  129. package/scripts/healthbench_professional_run.py +112 -0
  130. package/scripts/mlcr-run.sh +17 -0
  131. package/scripts/mlcr_run.py +133 -0
  132. package/scripts/prbench-run.sh +39 -0
  133. package/scripts/prbench_run.py +53 -0
  134. package/scripts/verify-packed-consumer.mjs +32 -27
  135. package/src/adapters.ts +5 -7
  136. package/src/atom-mcp-e2e.mts +2 -2
  137. package/src/benchmarks/_harness.test.mts +18 -1
  138. package/src/benchmarks/_harness.ts +12 -7
  139. package/src/benchmarks/aec-bench.test.mts +14 -14
  140. package/src/benchmarks/aec-bench.ts +62 -56
  141. package/src/benchmarks/agent-eval-contract.test.mts +38 -0
  142. package/src/benchmarks/agentbench.ts +44 -37
  143. package/src/benchmarks/appworld.test.mts +7 -7
  144. package/src/benchmarks/appworld.ts +88 -75
  145. package/src/benchmarks/bfcl.ts +60 -53
  146. package/src/benchmarks/cad-design.ts +34 -32
  147. package/src/benchmarks/cadbench.ts +36 -36
  148. package/src/benchmarks/cadgenbench.ts +30 -28
  149. package/src/benchmarks/commit0.test.mts +9 -9
  150. package/src/benchmarks/commit0.ts +50 -43
  151. package/src/benchmarks/crag.ts +45 -40
  152. package/src/benchmarks/dabstep-official.test.mts +8 -8
  153. package/src/benchmarks/dabstep.test.mts +11 -11
  154. package/src/benchmarks/dabstep.ts +47 -40
  155. package/src/benchmarks/external-adapters.test.mts +43 -44
  156. package/src/benchmarks/finresearchbench.ts +58 -48
  157. package/src/benchmarks/finsearchcomp.ts +73 -68
  158. package/src/benchmarks/frames.ts +76 -69
  159. package/src/benchmarks/hotpotqa.ts +69 -64
  160. package/src/benchmarks/humaneval.ts +37 -35
  161. package/src/benchmarks/mcad-bench.test.mts +30 -30
  162. package/src/benchmarks/mcad-bench.ts +66 -60
  163. package/src/benchmarks/mcad-cq-bench.ts +69 -63
  164. package/src/benchmarks/mcad-cq-golds.ts +1 -1
  165. package/src/benchmarks/mcad-cq.test.mts +40 -40
  166. package/src/benchmarks/mcad-golds.ts +1 -1
  167. package/src/benchmarks/mind2web.ts +66 -58
  168. package/src/benchmarks/nomiracl.ts +53 -46
  169. package/src/benchmarks/open-rag-bench.ts +47 -42
  170. package/src/benchmarks/programbench.test.mts +10 -10
  171. package/src/benchmarks/programbench.ts +38 -33
  172. package/src/benchmarks/rag-benchmarks.test.mts +31 -31
  173. package/src/benchmarks/rag-shared.ts +13 -16
  174. package/src/benchmarks/ragbench.ts +44 -39
  175. package/src/benchmarks/simpleqa.ts +79 -74
  176. package/src/benchmarks/swe-bench.test.mts +3 -3
  177. package/src/benchmarks/swe-bench.ts +66 -61
  178. package/src/benchmarks/t2-ragbench.ts +47 -42
  179. package/src/benchmarks/tau-bench-shared.ts +51 -44
  180. package/src/benchmarks/tau-pin.test.mts +1 -1
  181. package/src/benchmarks/tau2-bench.ts +2 -2
  182. package/src/benchmarks/tau3-banking.ts +2 -2
  183. package/src/benchmarks/terminal-bench.test.mts +3 -3
  184. package/src/benchmarks/terminal-bench.ts +41 -36
  185. package/src/benchmarks/toollm.ts +54 -47
  186. package/src/benchmarks/trata-hedge.ts +61 -58
  187. package/src/benchmarks/types.ts +70 -59
  188. package/src/benchmarks/webarena-verified.ts +49 -42
  189. package/src/cli.ts +74 -0
  190. package/src/corpus-replay.mts +9 -9
  191. package/src/examples/benchmark-matrix.mts +19 -16
  192. package/src/examples/lean-proof-gate.mts +1 -1
  193. package/src/examples/math-demo.mts +2 -2
  194. package/src/examples/strategy-demo.mts +1 -1
  195. package/src/gate-cli.mts +6 -6
  196. package/src/gate.test.mts +14 -12
  197. package/src/gate.ts +23 -22
  198. package/src/generate-eval/certify.ts +4 -4
  199. package/src/index.ts +17 -11
  200. package/src/published.test.mts +534 -0
  201. package/src/published.ts +524 -0
  202. package/src/run-benchmarks-cli.mts +3 -3
  203. package/src/run-benchmarks.test.mts +58 -48
  204. package/src/run-benchmarks.ts +64 -57
  205. package/src/swe-bench-env.ts +6 -6
  206. package/src/swe-self-improve.mts +3 -3
  207. package/src/terminal-compare.ts +1 -1
  208. package/src/worker.ts +1 -1
  209. package/dist/benchmarks/enterpriseops-gym.d.ts +0 -6
  210. package/dist/benchmarks/enterpriseops-gym.js +0 -236
  211. package/dist/benchmarks/enterpriseops-gym.js.map +0 -1
  212. package/dist/cadbench-DhAndllg.js.map +0 -1
  213. package/dist/cadgenbench-Tvk16YKT.js.map +0 -1
  214. package/fixtures/enterpriseops-gym.json +0 -103
  215. package/scripts/enterpriseops_gym_judge.py +0 -281
  216. package/src/benchmarks/enterpriseops-gym.test.mts +0 -77
  217. package/src/benchmarks/enterpriseops-gym.ts +0 -343
  218. package/src/eops-skills/address-every-subtask.md +0 -5
  219. package/src/eops-skills/exact-tools-and-args.md +0 -5
  220. package/src/eops-skills/full-sequence-to-goal.md +0 -5
  221. package/src/eops-skills/ground-every-value.md +0 -5
  222. package/src/eops-skills/honor-the-policies.md +0 -5
@@ -1,7 +1,8 @@
1
1
  import { venvPythonAt } from "./_harness.js";
2
- import { MCAD_DELIVERABLE, MCAD_DELIVERABLE_MULTIBODY, MCAD_TASKS } from "./mcad-tasks.js";
3
2
  import { measureMesh, parseAsciiStl, scoreAgainstSpec, stripCodeFence } from "./mcad-bench.js";
4
3
  import { MCAD_CQ_GOLDS, MCAD_CQ_UNCALIBRATED } from "./mcad-cq-golds.js";
4
+ import { MCAD_DELIVERABLE, MCAD_DELIVERABLE_MULTIBODY, MCAD_TASKS } from "./mcad-tasks.js";
5
+ import { runtimeBenchmark } from "./types.js";
5
6
  import { mkdtemp, open, readFile, writeFile } from "node:fs/promises";
6
7
  import { isAbsolute, join } from "node:path";
7
8
  import { execFile } from "node:child_process";
@@ -232,28 +233,15 @@ function withStepCheck(scored, stepEmitted) {
232
233
  };
233
234
  }
234
235
  function createMcadCqAdapter() {
235
- return {
236
- name: "mcad-cq",
237
- async preflight() {
238
- const python = resolveCadqueryPython();
239
- if (!existsSync(python)) throw cadqueryMissingError(python);
240
- try {
241
- await execFileAsync(python, ["-c", "import cadquery; print(cadquery.__version__)"], {
242
- timeout: 3e5,
243
- env: scriptEnv(tmpdir())
244
- });
245
- } catch (err) {
246
- const e = err;
247
- throw cadqueryMissingError(python, `\`import cadquery\` failed: ${(e.stderr ?? e.message ?? "").trim().slice(-800)}`);
248
- }
249
- },
250
- async loadTasks(opts = {}) {
236
+ return runtimeBenchmark({
237
+ id: "mcad-cq",
238
+ async loadAll(opts = {}) {
251
239
  let tasks = MCAD_TASKS;
252
240
  if (opts.ids) tasks = tasks.filter((t) => opts.ids?.includes(t.id));
253
241
  if (opts.limit != null) tasks = tasks.slice(0, opts.limit);
254
242
  return tasks.map((t) => ({
255
243
  id: t.id,
256
- prompt: toCadQueryPrompt(t),
244
+ payload: { prompt: toCadQueryPrompt(t) },
257
245
  metadata: {
258
246
  spec: t.spec,
259
247
  source: t.source,
@@ -261,33 +249,31 @@ function createMcadCqAdapter() {
261
249
  }
262
250
  }));
263
251
  },
264
- async goldArtifact(task) {
265
- return MCAD_CQ_GOLDS[task.id];
266
- },
267
- async judge(task, artifact) {
252
+ async evaluate(task, artifact) {
268
253
  const spec = task.metadata?.spec;
269
254
  if (!spec) return {
270
- resolved: false,
255
+ passed: false,
271
256
  score: 0,
272
- detail: `task ${task.id} carries no mcad spec`
257
+ notes: `task ${task.id} carries no mcad spec`,
258
+ raw: {}
273
259
  };
274
260
  const src = stripCodeFence(artifact);
275
261
  if (!src) return {
276
- resolved: false,
262
+ passed: false,
277
263
  score: 0,
278
- detail: "empty artifact"
264
+ notes: "empty artifact",
265
+ raw: {}
279
266
  };
280
267
  const built = await runAndMeasureCadQuery(src);
281
268
  if (!built.ok) return {
282
- resolved: false,
269
+ passed: false,
283
270
  score: 0,
284
- detail: `${built.detail} [dir ${built.dir}, stepEmitted ${built.stepEmitted}]`
271
+ notes: `${built.detail} [dir ${built.dir}, stepEmitted ${built.stepEmitted}]`,
272
+ raw: {}
285
273
  };
286
274
  const { geo, tris, stlPath, stepEmitted, dir } = built;
287
- if (!geo.watertight) return {
288
- resolved: false,
289
- score: 0,
290
- detail: JSON.stringify({
275
+ if (!geo.watertight) {
276
+ const raw = {
291
277
  gate: "watertight",
292
278
  failed: [{
293
279
  name: "watertight",
@@ -301,37 +287,63 @@ function createMcadCqAdapter() {
301
287
  stepEmitted,
302
288
  stlPath,
303
289
  dir
304
- })
305
- };
290
+ };
291
+ return {
292
+ passed: false,
293
+ score: 0,
294
+ notes: JSON.stringify(raw),
295
+ raw
296
+ };
297
+ }
306
298
  const scored = withStepCheck(scoreAgainstSpec(geo, tris, spec), stepEmitted);
299
+ const raw = {
300
+ failed: scored.failed.map((c) => ({
301
+ name: c.name,
302
+ measured: c.measured,
303
+ expected: c.expected
304
+ })),
305
+ checks: Object.fromEntries(scored.checks.map((c) => [c.name, c.ok])),
306
+ geo: {
307
+ triangles: geo.triangles,
308
+ solids: geo.solids,
309
+ volume: +geo.volume.toFixed(2),
310
+ degenerateFaces: geo.degenerateFaces,
311
+ bbox: {
312
+ x: +geo.bbox.size.x.toFixed(3),
313
+ y: +geo.bbox.size.y.toFixed(3),
314
+ z: +geo.bbox.size.z.toFixed(3)
315
+ }
316
+ },
317
+ stepEmitted,
318
+ stlPath,
319
+ dir
320
+ };
307
321
  return {
308
- resolved: scored.resolved,
322
+ passed: scored.resolved,
309
323
  score: scored.score,
310
- detail: JSON.stringify({
311
- failed: scored.failed.map((c) => ({
312
- name: c.name,
313
- measured: c.measured,
314
- expected: c.expected
315
- })),
316
- checks: Object.fromEntries(scored.checks.map((c) => [c.name, c.ok])),
317
- geo: {
318
- triangles: geo.triangles,
319
- solids: geo.solids,
320
- volume: +geo.volume.toFixed(2),
321
- degenerateFaces: geo.degenerateFaces,
322
- bbox: {
323
- x: +geo.bbox.size.x.toFixed(3),
324
- y: +geo.bbox.size.y.toFixed(3),
325
- z: +geo.bbox.size.z.toFixed(3)
326
- }
327
- },
328
- stepEmitted,
329
- stlPath,
330
- dir
331
- })
324
+ notes: JSON.stringify(raw),
325
+ raw
332
326
  };
327
+ },
328
+ runtime: {
329
+ async preflight() {
330
+ const python = resolveCadqueryPython();
331
+ if (!existsSync(python)) throw cadqueryMissingError(python);
332
+ try {
333
+ await execFileAsync(python, ["-c", "import cadquery; print(cadquery.__version__)"], {
334
+ timeout: 3e5,
335
+ env: scriptEnv(tmpdir())
336
+ });
337
+ } catch (err) {
338
+ const e = err;
339
+ throw cadqueryMissingError(python, `\`import cadquery\` failed: ${(e.stderr ?? e.message ?? "").trim().slice(-800)}`);
340
+ }
341
+ },
342
+ async goldArtifact(task) {
343
+ return MCAD_CQ_GOLDS[task.id];
344
+ }
333
345
  }
334
- };
346
+ });
335
347
  }
336
348
  export { CADQUERY_INSTALL_FIX, CADQUERY_VENV, MCAD_CQ_DELIVERABLE, MCAD_CQ_DELIVERABLE_MULTIBODY, MCAD_CQ_TIMEOUT_MS, STEP_MAGIC, STEP_NAME, STL_NAME, asciiStlProblem, cadqueryMissingError, createMcadCqAdapter, resolveCadqueryPython, runAndMeasureCadQuery, stepFileEmitted, toCadQueryPrompt, withStepCheck };
337
349
 
@@ -1 +1 @@
1
- {"version":3,"file":"mcad-cq-bench.js","names":[],"sources":["../../src/benchmarks/mcad-cq-bench.ts"],"sourcesContent":["/**\n * MCAD-CQ adapter — the v2 runner that closes v1's format deviation.\n *\n * `mcad-tasks.ts` states the deviation in its header: the upstream text-to-cad\n * benchmark asks for STEP, and OpenSCAD cannot emit it, so v1 grades an STL that\n * OpenSCAD compiled. This adapter runs the SAME ten dimensioned parts against the\n * SAME spec assertions, but the worker's artifact is a Python CadQuery script that\n * must export BOTH `part.step` (the format upstream actually asks for) and\n * `part.stl` (ASCII — what the geometry engine measures).\n *\n * Everything downstream of the mesh is v1's engine, IMPORTED not copied:\n * `parseAsciiStl` / `measureMesh` / `pointInSolid` / `scoreAgainstSpec` /\n * `stripCodeFence` all come from `./mcad-bench`, and the specs come from\n * `./mcad-tasks`. Only two things differ:\n * 1. the deliverable preamble (Python + CadQuery, not OpenSCAD) — applied by\n * mapping at load time, so v1's prompt strings are never mutated;\n * 2. one EXTRA scored check, `stepEmitted`: `part.step` exists and begins with\n * `ISO-10303-21` (the ISO 10303-21 exchange-file magic every STEP file\n * opens with). It is scored like any other assertion, so a script that\n * emits only the mesh cannot reach 1.0 no matter how correct its geometry.\n *\n * Pipeline, in order:\n * 1. run : `<python> model.py` in a fresh temp dir, 120 s hard deadline\n * 2. deliver : `part.stl` exists and is ASCII (a binary STL is a miss, not a\n * parse problem — the prompt pins the format)\n * 3. watertight: every undirected edge shared by exactly two faces\n * 4. measure : bbox / volume / connected components / triangle count\n * 5. probe : ray-parity point-in-solid at the spec's pinned coordinates\n * 6. step : the `stepEmitted` check above\n * A non-watertight mesh scores 0 for the same reason as v1: an unclosed surface\n * has no well-defined interior, so every downstream number would be fiction.\n *\n * SAFETY, stated once and deliberately. The judge EXECUTES the worker's Python on\n * the host with no sandbox. That is the same trust level as v1 handing arbitrary\n * source to the OpenSCAD kernel, and it carries the same rule: run this judge only\n * on artifacts you would be willing to run by hand. The child process is given a\n * scrubbed environment — no inherited variables beyond `PATH`, `HOME`/`TMPDIR`\n * pointed at the scratch directory, and proxy variables pointed at a closed port —\n * which DISCOURAGES network access and keeps host secrets out of the script's\n * reach. It is not a network jail and does not claim to be one; put the judge in a\n * container if you need that guarantee.\n *\n * Requires an interpreter that can `import cadquery` at JUDGE time only.\n * Resolution order: `MCAD_CQ_PYTHON` (absolute path) → `bench/.venv-cadquery/bin/python`\n * → throw with the exact install command (see `CADQUERY_INSTALL_FIX`).\n */\n\nimport { execFile } from 'node:child_process'\nimport { existsSync } from 'node:fs'\nimport { mkdtemp, open, readFile, writeFile } from 'node:fs/promises'\nimport { tmpdir } from 'node:os'\nimport { isAbsolute, join } from 'node:path'\nimport { promisify } from 'node:util'\nimport { venvPythonAt } from './_harness'\nimport {\n type McadCheck,\n type McadGeometry,\n type McadScoring,\n type McadTaskMeta,\n type Tri,\n measureMesh,\n parseAsciiStl,\n scoreAgainstSpec,\n stripCodeFence,\n} from './mcad-bench'\nimport { MCAD_CQ_GOLDS, MCAD_CQ_UNCALIBRATED } from './mcad-cq-golds'\nimport { MCAD_DELIVERABLE, MCAD_DELIVERABLE_MULTIBODY, MCAD_TASKS, type McadTask } from './mcad-tasks'\nimport type { BenchmarkAdapter, BenchScore, BenchTask, LoadOptions } from './types'\n\nconst execFileAsync = promisify(execFile)\n\n/** Package-relative venv, resolved through `_harness`'s bench-root lookup. */\nexport const CADQUERY_VENV = '.venv-cadquery'\n\n/** Files the worker's script must leave in its working directory. */\nexport const STL_NAME = 'part.stl'\nexport const STEP_NAME = 'part.step'\n\n/** Every ISO 10303-21 exchange file (a \"STEP file\") starts with this token. */\nexport const STEP_MAGIC = 'ISO-10303-21'\n\n/** Hard deadline for one worker script. A hang is a miss, not a stall. */\nexport const MCAD_CQ_TIMEOUT_MS = 120_000\n\n/**\n * The exact, VERIFIED install command. Two pins here are load-bearing and neither\n * is optional on a current host:\n * - `--python 3.12`: cadquery 2.4.0 resolves to `cadquery-ocp` 7.7.2, which ships\n * wheels for cp38–cp312 only. On a default CPython 3.13 the resolve fails.\n * - `'numpy<2'`: cadquery 2.4.0 pins `nptyping==2.0.1`, whose module body reads\n * `np.bool8` — removed in numpy 2. Without the pin `import cadquery` raises\n * `AttributeError: module 'numpy' has no attribute 'bool8'` at import time.\n */\nexport const CADQUERY_INSTALL_FIX =\n 'Fix: create the isolated CadQuery venv (needs `uv`):\\n' +\n ' cd bench && uv venv --python 3.12 .venv-cadquery \\\\\\n' +\n \" && uv pip install --python .venv-cadquery/bin/python 'cadquery==2.4.0' 'numpy<2'\\n\" +\n 'Both pins are required: cadquery-ocp 7.7.2 has no cp313 wheel, and cadquery 2.4.0 pins ' +\n \"nptyping 2.0.1, which reads the numpy-1.x-only `np.bool8` at import.\\n\" +\n 'Or set MCAD_CQ_PYTHON to the ABSOLUTE path of any interpreter that can `import cadquery`.'\n\n/**\n * Resolve the CadQuery interpreter. Never falls back to a system `python`: a\n * silent fallback would either fail deep inside a worker script or — worse — run\n * against a different CadQuery than the golds were calibrated on.\n */\nexport function resolveCadqueryPython(\n env: Readonly<{ MCAD_CQ_PYTHON?: string }> = process.env,\n): string {\n const configured = env.MCAD_CQ_PYTHON\n if (configured === undefined) return venvPythonAt(CADQUERY_VENV)\n if (!isAbsolute(configured)) throw new Error(`MCAD_CQ_PYTHON must be an absolute path (got ${JSON.stringify(configured)})`)\n return configured\n}\n\n/** The one message shape for \"there is no usable interpreter\" — HARNESS.md style. */\nexport function cadqueryMissingError(python: string, cause?: string): Error {\n return new Error(\n `mcad-cq: no CadQuery interpreter at ${python}${cause ? `\\n${cause}` : ''}\\n${CADQUERY_INSTALL_FIX}`,\n )\n}\n\n// ---------------------------------------------------------------------------\n// Prompt mapping (v1's prompt strings are read, never written)\n// ---------------------------------------------------------------------------\n\nconst CQ_EXPORT_STEP = `cq.exporters.export(result, \"${STEP_NAME}\")`\nconst CQ_EXPORT_STL =\n `cq.exporters.export(result, \"${STL_NAME}\", exportType=\"STL\", opt={\"ascii\": True}, ` +\n 'tolerance=0.01, angularTolerance=0.05)'\n\n/** Shared tail: what the script must WRITE, which is the whole deliverable contract. */\nconst CQ_DELIVERABLE_TAIL =\n 'The script must run standalone under `python model.py` and write BOTH of these files into its ' +\n `current working directory: \\`${STEP_NAME}\\` (STEP) and \\`${STL_NAME}\\` (ASCII STL, not binary). ` +\n 'Export with exactly these two lines:\\n' +\n ` ${CQ_EXPORT_STEP}\\n` +\n ` ${CQ_EXPORT_STL}\\n` +\n 'Those tessellation tolerances are what make round features accurate — do not coarsen them. ' +\n 'Reply with ONLY the Python code.'\n\n/** v2 replacement for `MCAD_DELIVERABLE`. */\nexport const MCAD_CQ_DELIVERABLE =\n 'Author a Python script using CadQuery (units: mm) that builds exactly this part as one fused solid ' +\n 'and binds it to a variable named `result`. ' +\n CQ_DELIVERABLE_TAIL\n\n/** v2 replacement for `MCAD_DELIVERABLE_MULTIBODY` — task 10 only, same reason as v1. */\nexport const MCAD_CQ_DELIVERABLE_MULTIBODY =\n 'Author a Python script using CadQuery (units: mm) that builds exactly this assembly as the separate ' +\n 'solid bodies listed below and binds them to a variable named `result` (a `cq.Compound` of those bodies, ' +\n 'or a Workplane holding all of them). The bodies must stay disjoint — no two of them may touch or ' +\n 'intersect. ' +\n CQ_DELIVERABLE_TAIL\n\n/**\n * Swap the deliverable preamble for the CadQuery one, leaving the upstream\n * dimensional text byte-identical. Fails loud rather than guessing: a task whose\n * prompt does not open with one of v1's two known preambles means v1 changed\n * shape, and silently shipping a prompt with two contradictory deliverables is\n * exactly the failure this function exists to prevent.\n */\nexport function toCadQueryPrompt(task: McadTask): string {\n for (const [v1, v2] of [\n [MCAD_DELIVERABLE_MULTIBODY, MCAD_CQ_DELIVERABLE_MULTIBODY],\n [MCAD_DELIVERABLE, MCAD_CQ_DELIVERABLE],\n ] as const) {\n if (task.prompt.startsWith(v1)) return v2 + task.prompt.slice(v1.length)\n }\n throw new Error(\n `mcad-cq: task ${task.id} does not open with a known mcad deliverable preamble; ` +\n 'mcad-tasks.ts changed shape and the CadQuery prompt mapping must be updated with it',\n )\n}\n\n// ---------------------------------------------------------------------------\n// Running the worker's script\n// ---------------------------------------------------------------------------\n\n/**\n * The child's whole environment. Nothing is inherited except `PATH` (the\n * interpreter needs its own toolchain on it) and `LANG`. `HOME`/`TMPDIR` point at\n * the scratch dir so the script cannot write to the operator's home, and the proxy\n * variables point at port 9 (discard), which every mainstream HTTP client honours.\n * DISCOURAGEMENT, not a jail — see the file header.\n */\nfunction scriptEnv(dir: string): NodeJS.ProcessEnv {\n const blackhole = 'http://127.0.0.1:9'\n return {\n PATH: process.env.PATH ?? '/usr/bin:/bin',\n LANG: process.env.LANG ?? 'C.UTF-8',\n HOME: dir,\n TMPDIR: dir,\n PYTHONDONTWRITEBYTECODE: '1',\n PYTHONHASHSEED: '0',\n http_proxy: blackhole,\n https_proxy: blackhole,\n HTTP_PROXY: blackhole,\n HTTPS_PROXY: blackhole,\n no_proxy: '',\n NO_PROXY: '',\n }\n}\n\n/**\n * Reject anything that is not an ASCII STL. A binary STL also opens with the\n * bytes `solid` often enough that the header alone is not a test, so the NUL scan\n * carries the decision: ASCII STL is printable text end to end.\n */\nexport function asciiStlProblem(buf: Buffer): string | undefined {\n if (buf.length === 0) return `${STL_NAME} is empty`\n if (buf.includes(0)) return `${STL_NAME} is not ASCII (contains NUL bytes — it looks like a binary STL)`\n const head = buf.subarray(0, 64).toString('latin1')\n if (!/^\\s*solid\\b/.test(head)) return `${STL_NAME} does not start with \"solid\" (got ${JSON.stringify(head.slice(0, 32))})`\n if (!/\\bfacet\\s+normal\\b/.test(buf.toString('utf8'))) return `${STL_NAME} contains no \"facet normal\" records`\n return undefined\n}\n\n/** `part.step` exists AND opens with the ISO 10303-21 magic. Reads 12 bytes, not the file. */\nexport async function stepFileEmitted(path: string): Promise<boolean> {\n let handle: Awaited<ReturnType<typeof open>>\n try {\n handle = await open(path, 'r')\n } catch {\n return false\n }\n try {\n const buf = Buffer.alloc(STEP_MAGIC.length)\n const { bytesRead } = await handle.read(buf, 0, buf.length, 0)\n return bytesRead === buf.length && buf.toString('latin1') === STEP_MAGIC\n } finally {\n await handle.close()\n }\n}\n\nexport type McadCqBuild =\n | { ok: true; geo: McadGeometry; tris: Tri[]; dir: string; stlPath: string; stepEmitted: boolean }\n | { ok: false; detail: string; dir: string; stepEmitted: boolean }\n\n/**\n * Run one CadQuery script and measure what it delivered. Judge-time only.\n * Throws (never scores) when there is no usable interpreter — an absent toolchain\n * is an operator defect, and scoring it 0 would silently poison a whole corpus.\n */\nexport async function runAndMeasureCadQuery(src: string, timeoutMs = MCAD_CQ_TIMEOUT_MS): Promise<McadCqBuild> {\n const python = resolveCadqueryPython()\n if (!existsSync(python)) throw cadqueryMissingError(python)\n\n const dir = await mkdtemp(join(tmpdir(), 'mcad-cq-'))\n const stlPath = join(dir, STL_NAME)\n const stepPath = join(dir, STEP_NAME)\n await writeFile(join(dir, 'model.py'), `${src}\\n`)\n\n const fail = async (detail: string): Promise<McadCqBuild> => ({\n ok: false,\n detail,\n dir,\n stepEmitted: await stepFileEmitted(stepPath),\n })\n\n try {\n await execFileAsync(python, ['model.py'], {\n cwd: dir,\n env: scriptEnv(dir),\n timeout: timeoutMs,\n killSignal: 'SIGKILL',\n maxBuffer: 1024 * 1024 * 64,\n })\n } catch (err) {\n const e = err as NodeJS.ErrnoException & { killed?: boolean; stderr?: string }\n if (e.killed) return fail(`script timed out after ${timeoutMs} ms and was killed`)\n const stderr = (e.stderr ?? e.message ?? '').trim()\n return fail(`script failed: ${stderr.slice(-800)}`)\n }\n\n let stl: Buffer\n try {\n stl = await readFile(stlPath)\n } catch {\n return fail(`script wrote no ${STL_NAME} in its working directory`)\n }\n const bad = asciiStlProblem(stl)\n if (bad) return fail(bad)\n\n const tris = parseAsciiStl(stl.toString('utf8'))\n if (tris.length === 0) return fail(`${STL_NAME} parsed to zero triangles (empty geometry)`)\n\n return {\n ok: true,\n geo: measureMesh(tris),\n tris,\n dir,\n stlPath,\n stepEmitted: await stepFileEmitted(stepPath),\n }\n}\n\n// ---------------------------------------------------------------------------\n// Scoring\n// ---------------------------------------------------------------------------\n\n/**\n * Append the STEP-delivery check to a v1 scoring and recompute. It is one check\n * among the spec's, deliberately: the upstream benchmark's deliverable IS a STEP\n * file, so failing to produce one costs exactly what failing a dimension costs.\n */\nexport function withStepCheck(scored: McadScoring, stepEmitted: boolean): McadScoring {\n const check: McadCheck = {\n name: 'stepEmitted',\n ok: stepEmitted,\n measured: stepEmitted ? `${STEP_NAME} starts with ${STEP_MAGIC}` : `no ${STEP_NAME} starting with ${STEP_MAGIC}`,\n expected: `${STEP_NAME} exists and starts with ${STEP_MAGIC}`,\n }\n const checks = [...scored.checks, check]\n const failed = checks.filter((c) => !c.ok)\n return { checks, failed, score: (checks.length - failed.length) / checks.length, resolved: failed.length === 0 }\n}\n\n// ---------------------------------------------------------------------------\n// Adapter\n// ---------------------------------------------------------------------------\n\nexport function createMcadCqAdapter(): BenchmarkAdapter {\n return {\n name: 'mcad-cq',\n\n async preflight() {\n const python = resolveCadqueryPython()\n if (!existsSync(python)) throw cadqueryMissingError(python)\n try {\n await execFileAsync(python, ['-c', 'import cadquery; print(cadquery.__version__)'], {\n timeout: 300_000,\n env: scriptEnv(tmpdir()),\n })\n } catch (err) {\n const e = err as NodeJS.ErrnoException & { stderr?: string }\n throw cadqueryMissingError(python, `\\`import cadquery\\` failed: ${(e.stderr ?? e.message ?? '').trim().slice(-800)}`)\n }\n },\n\n async loadTasks(opts: LoadOptions = {}) {\n let tasks: McadTask[] = MCAD_TASKS\n if (opts.ids) tasks = tasks.filter((t) => opts.ids?.includes(t.id))\n if (opts.limit != null) tasks = tasks.slice(0, opts.limit)\n return tasks.map(\n (t): BenchTask => ({\n id: t.id,\n prompt: toCadQueryPrompt(t),\n metadata: {\n spec: t.spec,\n source: t.source,\n // Calibration is per-ADAPTER: a task calibrated against the OpenSCAD\n // gold says nothing about whether a CadQuery gold reaches 1.0 here.\n calibrated: t.calibrated && !MCAD_CQ_UNCALIBRATED.has(t.id),\n } satisfies McadTaskMeta,\n }),\n )\n },\n\n async goldArtifact(task: BenchTask) {\n return MCAD_CQ_GOLDS[task.id]\n },\n\n async judge(task: BenchTask, artifact: string): Promise<BenchScore> {\n const spec = (task.metadata as McadTaskMeta | undefined)?.spec\n if (!spec) return { resolved: false, score: 0, detail: `task ${task.id} carries no mcad spec` }\n\n const src = stripCodeFence(artifact)\n if (!src) return { resolved: false, score: 0, detail: 'empty artifact' }\n\n const built = await runAndMeasureCadQuery(src)\n if (!built.ok) {\n return { resolved: false, score: 0, detail: `${built.detail} [dir ${built.dir}, stepEmitted ${built.stepEmitted}]` }\n }\n\n const { geo, tris, stlPath, stepEmitted, dir } = built\n if (!geo.watertight) {\n return {\n resolved: false,\n score: 0,\n detail: JSON.stringify({\n gate: 'watertight',\n failed: [\n {\n name: 'watertight',\n measured: `${geo.openEdges} edge(s) not shared by exactly two faces`,\n expected: '0 open edges (closed 2-manifold solid)',\n },\n ],\n geo: { triangles: geo.triangles, degenerateFaces: geo.degenerateFaces },\n stepEmitted,\n stlPath,\n dir,\n }),\n }\n }\n\n const scored = withStepCheck(scoreAgainstSpec(geo, tris, spec), stepEmitted)\n return {\n resolved: scored.resolved,\n score: scored.score,\n detail: JSON.stringify({\n failed: scored.failed.map((c) => ({ name: c.name, measured: c.measured, expected: c.expected })),\n checks: Object.fromEntries(scored.checks.map((c) => [c.name, c.ok])),\n geo: {\n triangles: geo.triangles,\n solids: geo.solids,\n volume: +geo.volume.toFixed(2),\n degenerateFaces: geo.degenerateFaces,\n bbox: {\n x: +geo.bbox.size.x.toFixed(3),\n y: +geo.bbox.size.y.toFixed(3),\n z: +geo.bbox.size.z.toFixed(3),\n },\n },\n stepEmitted,\n stlPath,\n dir,\n }),\n }\n },\n }\n}\n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AGrH,MAAM,EAAE,KAAK,MAAM,SAAS,aAAa,QAAQ;GACjD,IAAI,CAAC,IAAI,YACP,OAAO;IACL,UAAU;IACV,OAAO;IACP,QAAQ,KAAK,UAAU;KACrB,MAAM;KACN,QAAQ,CACN;MACE,MAAM;MACN,UAAU,GAAG,IAAI,UAAU;MAC3B,UAAU;KACZ,CACF;KACA,KAAK;MAAE,WAAW,IAAI;MAAW,iBAAiB,IAAI;KAAgB;KACtE;KACA;KACA;IACF,CAAC;GACH;GAGF,MAAM,SAAS,cAAc,iBAAiB,KAAK,MAAM,IAAI,GAAG,WAAW;GAC3E,OAAO;IACL,UAAU,OAAO;IACjB,OAAO,OAAO;IACd,QAAQ,KAAK,UAAU;KACrB,QAAQ,OAAO,OAAO,KAAK,OAAO;MAAE,MAAM,EAAE;MAAM,UAAU,EAAE;MAAU,UAAU,EAAE;KAAS,EAAE;KAC/F,QAAQ,OAAO,YAAY,OAAO,OAAO,KAAK,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;KACnE,KAAK;MACH,WAAW,IAAI;MACf,QAAQ,IAAI;MACZ,QAAQ,CAAC,IAAI,OAAO,QAAQ,CAAC;MAC7B,iBAAiB,IAAI;MACrB,MAAM;OACJ,GAAG,CAAC,IAAI,KAAK,KAAK,EAAE,QAAQ,CAAC;OAC7B,GAAG,CAAC,IAAI,KAAK,KAAK,EAAE,QAAQ,CAAC;OAC7B,GAAG,CAAC,IAAI,KAAK,KAAK,EAAE,QAAQ,CAAC;MAC/B;KACF;KACA;KACA;KACA;IACF,CAAC;GACH;EACF;CACF;AACF"}
1
+ {"version":3,"file":"mcad-cq-bench.js","names":[],"sources":["../../src/benchmarks/mcad-cq-bench.ts"],"sourcesContent":["/**\n * MCAD-CQ adapter — the v2 runner that closes v1's format deviation.\n *\n * `mcad-tasks.ts` states the deviation in its header: the upstream text-to-cad\n * benchmark asks for STEP, and OpenSCAD cannot emit it, so v1 grades an STL that\n * OpenSCAD compiled. This adapter runs the SAME ten dimensioned parts against the\n * SAME spec assertions, but the worker's artifact is a Python CadQuery script that\n * must export BOTH `part.step` (the format upstream actually asks for) and\n * `part.stl` (ASCII — what the geometry engine measures).\n *\n * Everything downstream of the mesh is v1's engine, IMPORTED not copied:\n * `parseAsciiStl` / `measureMesh` / `pointInSolid` / `scoreAgainstSpec` /\n * `stripCodeFence` all come from `./mcad-bench`, and the specs come from\n * `./mcad-tasks`. Only two things differ:\n * 1. the deliverable preamble (Python + CadQuery, not OpenSCAD) — applied by\n * mapping at load time, so v1's prompt strings are never mutated;\n * 2. one EXTRA scored check, `stepEmitted`: `part.step` exists and begins with\n * `ISO-10303-21` (the ISO 10303-21 exchange-file magic every STEP file\n * opens with). It is scored like any other assertion, so a script that\n * emits only the mesh cannot reach 1.0 no matter how correct its geometry.\n *\n * Pipeline, in order:\n * 1. run : `<python> model.py` in a fresh temp dir, 120 s hard deadline\n * 2. deliver : `part.stl` exists and is ASCII (a binary STL is a miss, not a\n * parse problem — the prompt pins the format)\n * 3. watertight: every undirected edge shared by exactly two faces\n * 4. measure : bbox / volume / connected components / triangle count\n * 5. probe : ray-parity point-in-solid at the spec's pinned coordinates\n * 6. step : the `stepEmitted` check above\n * A non-watertight mesh scores 0 for the same reason as v1: an unclosed surface\n * has no well-defined interior, so every downstream number would be fiction.\n *\n * SAFETY, stated once and deliberately. The judge EXECUTES the worker's Python on\n * the host with no sandbox. That is the same trust level as v1 handing arbitrary\n * source to the OpenSCAD kernel, and it carries the same rule: run this judge only\n * on artifacts you would be willing to run by hand. The child process is given a\n * scrubbed environment — no inherited variables beyond `PATH`, `HOME`/`TMPDIR`\n * pointed at the scratch directory, and proxy variables pointed at a closed port —\n * which DISCOURAGES network access and keeps host secrets out of the script's\n * reach. It is not a network jail and does not claim to be one; put the judge in a\n * container if you need that guarantee.\n *\n * Requires an interpreter that can `import cadquery` at JUDGE time only.\n * Resolution order: `MCAD_CQ_PYTHON` (absolute path) → `bench/.venv-cadquery/bin/python`\n * → throw with the exact install command (see `CADQUERY_INSTALL_FIX`).\n */\n\nimport { execFile } from 'node:child_process'\nimport { existsSync } from 'node:fs'\nimport { mkdtemp, open, readFile, writeFile } from 'node:fs/promises'\nimport { tmpdir } from 'node:os'\nimport { isAbsolute, join } from 'node:path'\nimport { promisify } from 'node:util'\nimport { venvPythonAt } from './_harness'\nimport {\n type McadCheck,\n type McadGeometry,\n type McadScoring,\n type McadTaskMeta,\n type Tri,\n measureMesh,\n parseAsciiStl,\n scoreAgainstSpec,\n stripCodeFence,\n} from './mcad-bench'\nimport { MCAD_CQ_GOLDS, MCAD_CQ_UNCALIBRATED } from './mcad-cq-golds'\nimport { MCAD_DELIVERABLE, MCAD_DELIVERABLE_MULTIBODY, MCAD_TASKS, type McadTask } from './mcad-tasks'\nimport { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'\n\nconst execFileAsync = promisify(execFile)\n\n/** Package-relative venv, resolved through `_harness`'s bench-root lookup. */\nexport const CADQUERY_VENV = '.venv-cadquery'\n\n/** Files the worker's script must leave in its working directory. */\nexport const STL_NAME = 'part.stl'\nexport const STEP_NAME = 'part.step'\n\n/** Every ISO 10303-21 exchange file (a \"STEP file\") starts with this token. */\nexport const STEP_MAGIC = 'ISO-10303-21'\n\n/** Hard deadline for one worker script. A hang is a miss, not a stall. */\nexport const MCAD_CQ_TIMEOUT_MS = 120_000\n\n/**\n * The exact, VERIFIED install command. Two pins here are load-bearing and neither\n * is optional on a current host:\n * - `--python 3.12`: cadquery 2.4.0 resolves to `cadquery-ocp` 7.7.2, which ships\n * wheels for cp38–cp312 only. On a default CPython 3.13 the resolve fails.\n * - `'numpy<2'`: cadquery 2.4.0 pins `nptyping==2.0.1`, whose module body reads\n * `np.bool8` — removed in numpy 2. Without the pin `import cadquery` raises\n * `AttributeError: module 'numpy' has no attribute 'bool8'` at import time.\n */\nexport const CADQUERY_INSTALL_FIX =\n 'Fix: create the isolated CadQuery venv (needs `uv`):\\n' +\n ' cd bench && uv venv --python 3.12 .venv-cadquery \\\\\\n' +\n \" && uv pip install --python .venv-cadquery/bin/python 'cadquery==2.4.0' 'numpy<2'\\n\" +\n 'Both pins are required: cadquery-ocp 7.7.2 has no cp313 wheel, and cadquery 2.4.0 pins ' +\n \"nptyping 2.0.1, which reads the numpy-1.x-only `np.bool8` at import.\\n\" +\n 'Or set MCAD_CQ_PYTHON to the ABSOLUTE path of any interpreter that can `import cadquery`.'\n\n/**\n * Resolve the CadQuery interpreter. Never falls back to a system `python`: a\n * silent fallback would either fail deep inside a worker script or — worse — run\n * against a different CadQuery than the golds were calibrated on.\n */\nexport function resolveCadqueryPython(\n env: Readonly<{ MCAD_CQ_PYTHON?: string }> = process.env,\n): string {\n const configured = env.MCAD_CQ_PYTHON\n if (configured === undefined) return venvPythonAt(CADQUERY_VENV)\n if (!isAbsolute(configured)) throw new Error(`MCAD_CQ_PYTHON must be an absolute path (got ${JSON.stringify(configured)})`)\n return configured\n}\n\n/** The one message shape for \"there is no usable interpreter\" — HARNESS.md style. */\nexport function cadqueryMissingError(python: string, cause?: string): Error {\n return new Error(\n `mcad-cq: no CadQuery interpreter at ${python}${cause ? `\\n${cause}` : ''}\\n${CADQUERY_INSTALL_FIX}`,\n )\n}\n\n// ---------------------------------------------------------------------------\n// Prompt mapping (v1's prompt strings are read, never written)\n// ---------------------------------------------------------------------------\n\nconst CQ_EXPORT_STEP = `cq.exporters.export(result, \"${STEP_NAME}\")`\nconst CQ_EXPORT_STL =\n `cq.exporters.export(result, \"${STL_NAME}\", exportType=\"STL\", opt={\"ascii\": True}, ` +\n 'tolerance=0.01, angularTolerance=0.05)'\n\n/** Shared tail: what the script must WRITE, which is the whole deliverable contract. */\nconst CQ_DELIVERABLE_TAIL =\n 'The script must run standalone under `python model.py` and write BOTH of these files into its ' +\n `current working directory: \\`${STEP_NAME}\\` (STEP) and \\`${STL_NAME}\\` (ASCII STL, not binary). ` +\n 'Export with exactly these two lines:\\n' +\n ` ${CQ_EXPORT_STEP}\\n` +\n ` ${CQ_EXPORT_STL}\\n` +\n 'Those tessellation tolerances are what make round features accurate — do not coarsen them. ' +\n 'Reply with ONLY the Python code.'\n\n/** v2 replacement for `MCAD_DELIVERABLE`. */\nexport const MCAD_CQ_DELIVERABLE =\n 'Author a Python script using CadQuery (units: mm) that builds exactly this part as one fused solid ' +\n 'and binds it to a variable named `result`. ' +\n CQ_DELIVERABLE_TAIL\n\n/** v2 replacement for `MCAD_DELIVERABLE_MULTIBODY` — task 10 only, same reason as v1. */\nexport const MCAD_CQ_DELIVERABLE_MULTIBODY =\n 'Author a Python script using CadQuery (units: mm) that builds exactly this assembly as the separate ' +\n 'solid bodies listed below and binds them to a variable named `result` (a `cq.Compound` of those bodies, ' +\n 'or a Workplane holding all of them). The bodies must stay disjoint — no two of them may touch or ' +\n 'intersect. ' +\n CQ_DELIVERABLE_TAIL\n\n/**\n * Swap the deliverable preamble for the CadQuery one, leaving the upstream\n * dimensional text byte-identical. Fails loud rather than guessing: a task whose\n * prompt does not open with one of v1's two known preambles means v1 changed\n * shape, and silently shipping a prompt with two contradictory deliverables is\n * exactly the failure this function exists to prevent.\n */\nexport function toCadQueryPrompt(task: McadTask): string {\n for (const [v1, v2] of [\n [MCAD_DELIVERABLE_MULTIBODY, MCAD_CQ_DELIVERABLE_MULTIBODY],\n [MCAD_DELIVERABLE, MCAD_CQ_DELIVERABLE],\n ] as const) {\n if (task.prompt.startsWith(v1)) return v2 + task.prompt.slice(v1.length)\n }\n throw new Error(\n `mcad-cq: task ${task.id} does not open with a known mcad deliverable preamble; ` +\n 'mcad-tasks.ts changed shape and the CadQuery prompt mapping must be updated with it',\n )\n}\n\n// ---------------------------------------------------------------------------\n// Running the worker's script\n// ---------------------------------------------------------------------------\n\n/**\n * The child's whole environment. Nothing is inherited except `PATH` (the\n * interpreter needs its own toolchain on it) and `LANG`. `HOME`/`TMPDIR` point at\n * the scratch dir so the script cannot write to the operator's home, and the proxy\n * variables point at port 9 (discard), which every mainstream HTTP client honours.\n * DISCOURAGEMENT, not a jail — see the file header.\n */\nfunction scriptEnv(dir: string): NodeJS.ProcessEnv {\n const blackhole = 'http://127.0.0.1:9'\n return {\n PATH: process.env.PATH ?? '/usr/bin:/bin',\n LANG: process.env.LANG ?? 'C.UTF-8',\n HOME: dir,\n TMPDIR: dir,\n PYTHONDONTWRITEBYTECODE: '1',\n PYTHONHASHSEED: '0',\n http_proxy: blackhole,\n https_proxy: blackhole,\n HTTP_PROXY: blackhole,\n HTTPS_PROXY: blackhole,\n no_proxy: '',\n NO_PROXY: '',\n }\n}\n\n/**\n * Reject anything that is not an ASCII STL. A binary STL also opens with the\n * bytes `solid` often enough that the header alone is not a test, so the NUL scan\n * carries the decision: ASCII STL is printable text end to end.\n */\nexport function asciiStlProblem(buf: Buffer): string | undefined {\n if (buf.length === 0) return `${STL_NAME} is empty`\n if (buf.includes(0)) return `${STL_NAME} is not ASCII (contains NUL bytes — it looks like a binary STL)`\n const head = buf.subarray(0, 64).toString('latin1')\n if (!/^\\s*solid\\b/.test(head)) return `${STL_NAME} does not start with \"solid\" (got ${JSON.stringify(head.slice(0, 32))})`\n if (!/\\bfacet\\s+normal\\b/.test(buf.toString('utf8'))) return `${STL_NAME} contains no \"facet normal\" records`\n return undefined\n}\n\n/** `part.step` exists AND opens with the ISO 10303-21 magic. Reads 12 bytes, not the file. */\nexport async function stepFileEmitted(path: string): Promise<boolean> {\n let handle: Awaited<ReturnType<typeof open>>\n try {\n handle = await open(path, 'r')\n } catch {\n return false\n }\n try {\n const buf = Buffer.alloc(STEP_MAGIC.length)\n const { bytesRead } = await handle.read(buf, 0, buf.length, 0)\n return bytesRead === buf.length && buf.toString('latin1') === STEP_MAGIC\n } finally {\n await handle.close()\n }\n}\n\nexport type McadCqBuild =\n | { ok: true; geo: McadGeometry; tris: Tri[]; dir: string; stlPath: string; stepEmitted: boolean }\n | { ok: false; detail: string; dir: string; stepEmitted: boolean }\n\n/**\n * Run one CadQuery script and measure what it delivered. Judge-time only.\n * Throws (never scores) when there is no usable interpreter — an absent toolchain\n * is an operator defect, and scoring it 0 would silently poison a whole corpus.\n */\nexport async function runAndMeasureCadQuery(src: string, timeoutMs = MCAD_CQ_TIMEOUT_MS): Promise<McadCqBuild> {\n const python = resolveCadqueryPython()\n if (!existsSync(python)) throw cadqueryMissingError(python)\n\n const dir = await mkdtemp(join(tmpdir(), 'mcad-cq-'))\n const stlPath = join(dir, STL_NAME)\n const stepPath = join(dir, STEP_NAME)\n await writeFile(join(dir, 'model.py'), `${src}\\n`)\n\n const fail = async (detail: string): Promise<McadCqBuild> => ({\n ok: false,\n detail,\n dir,\n stepEmitted: await stepFileEmitted(stepPath),\n })\n\n try {\n await execFileAsync(python, ['model.py'], {\n cwd: dir,\n env: scriptEnv(dir),\n timeout: timeoutMs,\n killSignal: 'SIGKILL',\n maxBuffer: 1024 * 1024 * 64,\n })\n } catch (err) {\n const e = err as NodeJS.ErrnoException & { killed?: boolean; stderr?: string }\n if (e.killed) return fail(`script timed out after ${timeoutMs} ms and was killed`)\n const stderr = (e.stderr ?? e.message ?? '').trim()\n return fail(`script failed: ${stderr.slice(-800)}`)\n }\n\n let stl: Buffer\n try {\n stl = await readFile(stlPath)\n } catch {\n return fail(`script wrote no ${STL_NAME} in its working directory`)\n }\n const bad = asciiStlProblem(stl)\n if (bad) return fail(bad)\n\n const tris = parseAsciiStl(stl.toString('utf8'))\n if (tris.length === 0) return fail(`${STL_NAME} parsed to zero triangles (empty geometry)`)\n\n return {\n ok: true,\n geo: measureMesh(tris),\n tris,\n dir,\n stlPath,\n stepEmitted: await stepFileEmitted(stepPath),\n }\n}\n\n// ---------------------------------------------------------------------------\n// Scoring\n// ---------------------------------------------------------------------------\n\n/**\n * Append the STEP-delivery check to a v1 scoring and recompute. It is one check\n * among the spec's, deliberately: the upstream benchmark's deliverable IS a STEP\n * file, so failing to produce one costs exactly what failing a dimension costs.\n */\nexport function withStepCheck(scored: McadScoring, stepEmitted: boolean): McadScoring {\n const check: McadCheck = {\n name: 'stepEmitted',\n ok: stepEmitted,\n measured: stepEmitted ? `${STEP_NAME} starts with ${STEP_MAGIC}` : `no ${STEP_NAME} starting with ${STEP_MAGIC}`,\n expected: `${STEP_NAME} exists and starts with ${STEP_MAGIC}`,\n }\n const checks = [...scored.checks, check]\n const failed = checks.filter((c) => !c.ok)\n return { checks, failed, score: (checks.length - failed.length) / checks.length, resolved: failed.length === 0 }\n}\n\n// ---------------------------------------------------------------------------\n// Adapter\n// ---------------------------------------------------------------------------\n\nexport function createMcadCqAdapter(): RuntimeBenchmark {\n return runtimeBenchmark({\n id: 'mcad-cq',\n\n async loadAll(opts: LoadOptions = {}) {\n let tasks: McadTask[] = MCAD_TASKS\n if (opts.ids) tasks = tasks.filter((t) => opts.ids?.includes(t.id))\n if (opts.limit != null) tasks = tasks.slice(0, opts.limit)\n return tasks.map(\n (t): BenchTask => ({\n id: t.id,\n payload: { prompt: toCadQueryPrompt(t) },\n metadata: {\n spec: t.spec,\n source: t.source,\n // Calibration is per-ADAPTER: a task calibrated against the OpenSCAD\n // gold says nothing about whether a CadQuery gold reaches 1.0 here.\n calibrated: t.calibrated && !MCAD_CQ_UNCALIBRATED.has(t.id),\n } satisfies McadTaskMeta,\n }),\n )\n },\n\n async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {\n const spec = (task.metadata as McadTaskMeta | undefined)?.spec\n if (!spec) return { passed: false, score: 0, notes: `task ${task.id} carries no mcad spec`, raw: {} }\n\n const src = stripCodeFence(artifact)\n if (!src) return { passed: false, score: 0, notes: 'empty artifact', raw: {} }\n\n const built = await runAndMeasureCadQuery(src)\n if (!built.ok) {\n return { passed: false, score: 0, notes: `${built.detail} [dir ${built.dir}, stepEmitted ${built.stepEmitted}]`, raw: {} }\n }\n\n const { geo, tris, stlPath, stepEmitted, dir } = built\n if (!geo.watertight) {\n const raw = {\n gate: 'watertight',\n failed: [\n {\n name: 'watertight',\n measured: `${geo.openEdges} edge(s) not shared by exactly two faces`,\n expected: '0 open edges (closed 2-manifold solid)',\n },\n ],\n geo: { triangles: geo.triangles, degenerateFaces: geo.degenerateFaces },\n stepEmitted,\n stlPath,\n dir,\n }\n return {\n passed: false,\n score: 0,\n notes: JSON.stringify(raw),\n raw,\n }\n }\n\n const scored = withStepCheck(scoreAgainstSpec(geo, tris, spec), stepEmitted)\n const raw = {\n failed: scored.failed.map((c) => ({ name: c.name, measured: c.measured, expected: c.expected })),\n checks: Object.fromEntries(scored.checks.map((c) => [c.name, c.ok])),\n geo: {\n triangles: geo.triangles,\n solids: geo.solids,\n volume: +geo.volume.toFixed(2),\n degenerateFaces: geo.degenerateFaces,\n bbox: {\n x: +geo.bbox.size.x.toFixed(3),\n y: +geo.bbox.size.y.toFixed(3),\n z: +geo.bbox.size.z.toFixed(3),\n },\n },\n stepEmitted,\n stlPath,\n dir,\n }\n return {\n passed: scored.resolved,\n score: scored.score,\n notes: JSON.stringify(raw),\n raw,\n }\n },\n\n runtime: {\n async preflight() {\n const python = resolveCadqueryPython()\n if (!existsSync(python)) throw cadqueryMissingError(python)\n try {\n await execFileAsync(python, ['-c', 'import cadquery; print(cadquery.__version__)'], {\n timeout: 300_000,\n env: scriptEnv(tmpdir()),\n })\n } catch (err) {\n const e = err as NodeJS.ErrnoException & { stderr?: string }\n throw cadqueryMissingError(python, `\\`import cadquery\\` failed: ${(e.stderr ?? e.message ?? '').trim().slice(-800)}`)\n }\n },\n\n async goldArtifact(task: BenchTask) {\n return MCAD_CQ_GOLDS[task.id]\n },\n },\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqEA,MAAM,gBAAgB,UAAU,QAAQ;;AAGxC,MAAa,gBAAgB;;AAG7B,MAAa,WAAW;AACxB,MAAa,YAAY;;AAGzB,MAAa,aAAa;;AAG1B,MAAa,qBAAqB;;;;;;;;;;AAWlC,MAAa,uBACX;;;;;;AAYF,SAAgB,sBACd,MAA6C,QAAQ,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AK;KACH,WAAW,IAAI;KACf,QAAQ,IAAI;KACZ,QAAQ,CAAC,IAAI,OAAO,QAAQ,CAAC;KAC7B,iBAAiB,IAAI;KACrB,MAAM;MACJ,GAAG,CAAC,IAAI,KAAK,KAAK,EAAE,QAAQ,CAAC;MAC7B,GAAG,CAAC,IAAI,KAAK,KAAK,EAAE,QAAQ,CAAC;MAC7B,GAAG,CAAC,IAAI,KAAK,KAAK,EAAE,QAAQ,CAAC;KAC/B;IACF;IACA;IACA;IACA;GACF;GACA,OAAO;IACL,QAAQ,OAAO;IACf,OAAO,OAAO;IACd,OAAO,KAAK,UAAU,GAAG;IACzB;GACF;EACF;EAEA,SAAS;GACP,MAAM,YAAY;IAChB,MAAM,SAAS,sBAAsB;IACrC,IAAI,CAAC,WAAW,MAAM,GAAG,MAAM,qBAAqB,MAAM;IAC1D,IAAI;KACF,MAAM,cAAc,QAAQ,CAAC,MAAM,8CAA8C,GAAG;MAClF,SAAS;MACT,KAAK,UAAU,OAAO,CAAC;KACzB,CAAC;IACH,SAAS,KAAK;KACZ,MAAM,IAAI;KACV,MAAM,qBAAqB,QAAQ,gCAAgC,EAAE,UAAU,EAAE,WAAW,GAAA,CAAI,KAAK,CAAC,CAAC,MAAM,IAAI,GAAG;IACtH;GACF;GAEA,MAAM,aAAa,MAAiB;IAClC,OAAO,cAAc,KAAK;GAC5B;EACF;CACF,CAAC;AACH"}
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * These are CALIBRATION artifacts, not exemplar answers: their whole job is to
5
5
  * prove this adapter's accept direction fires. Every one has been run through
6
- * `createMcadCqAdapter().judge()` on this host, and a task is reported calibrated
6
+ * `createMcadCqAdapter().evaluate()` on this host, and a task is reported calibrated
7
7
  * only when its gold below scores 1.0 — including the `stepEmitted` check, so
8
8
  * every gold really does write a STEP file, which is the deviation v1 could not
9
9
  * close.
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * These are CALIBRATION artifacts, not exemplar answers: their whole job is to
6
6
  * prove this adapter's accept direction fires. Every one has been run through
7
- * `createMcadCqAdapter().judge()` on this host, and a task is reported calibrated
7
+ * `createMcadCqAdapter().evaluate()` on this host, and a task is reported calibrated
8
8
  * only when its gold below scores 1.0 — including the `stepEmitted` check, so
9
9
  * every gold really does write a STEP file, which is the deviation v1 could not
10
10
  * close.
@@ -1 +1 @@
1
- {"version":3,"file":"mcad-cq-golds.js","names":[],"sources":["../../src/benchmarks/mcad-cq-golds.ts"],"sourcesContent":["/**\n * MCAD-CQ gold oracles — one Python CadQuery script per task in `mcad-tasks.ts`.\n *\n * These are CALIBRATION artifacts, not exemplar answers: their whole job is to\n * prove this adapter's accept direction fires. Every one has been run through\n * `createMcadCqAdapter().judge()` on this host, and a task is reported calibrated\n * only when its gold below scores 1.0 — including the `stepEmitted` check, so\n * every gold really does write a STEP file, which is the deviation v1 could not\n * close.\n *\n * They are written plain and share one preamble of four helpers. Two of those\n * helpers are not stylistic:\n * - `fuse_all` runs ONE multi-argument boolean instead of N sequential unions\n * on a growing solid. OCC's cost is superlinear in the accumulated face\n * count, and the fin stack (task 07), the staircase (task 09) and the blade\n * ring (task 08) all miss the judge's 120 s deadline the sequential way.\n * - `group` builds a compound of DISJOINT cutters, so a four-bore cut is one\n * boolean rather than four.\n *\n * Where a gold deviates from the prompt's literal dimensions the deviation is\n * named in a comment at the point of the deviation, with the reason. There is one,\n * inherited verbatim from v1: task 10's ring tooth-tip diameter.\n */\n\n/** Imports plus the four helpers every gold below uses. */\nconst PREAMBLE = `\nimport math\nimport cadquery as cq\n\n\ndef shape(s):\n \"\"\"Unwrap a Workplane to the Shape it holds; pass Shapes through unchanged.\"\"\"\n return s.val() if isinstance(s, cq.Workplane) else s\n\n\ndef rod(d, length, base, direction):\n \"\"\"Cylinder of diameter d, \\`length\\` long, from \\`base\\` along \\`direction\\`.\"\"\"\n return cq.Solid.makeCylinder(d / 2.0, length, cq.Vector(*base), cq.Vector(*direction))\n\n\ndef polar(r, deg):\n \"\"\"(x, y) at radius r and angle deg, counter-clockwise from +X.\"\"\"\n a = math.radians(deg)\n return (r * math.cos(a), r * math.sin(a))\n\n\ndef group(shapes):\n \"\"\"Disjoint shapes as one compound: no boolean, so no OCC cost.\"\"\"\n return cq.Compound.makeCompound([shape(s) for s in shapes])\n\n\ndef fuse_all(parts):\n \"\"\"ONE multi-argument boolean instead of N unions on a growing solid.\"\"\"\n xs = [shape(p) for p in parts]\n return xs[0] if len(xs) == 1 else xs[0].fuse(*xs[1:])\n`.trim()\n\n/** The two export lines the prompt pins, verbatim. */\nconst EXPORT = `\ncq.exporters.export(result, \"part.step\")\ncq.exporters.export(result, \"part.stl\", exportType=\"STL\", opt={\"ascii\": True}, tolerance=0.01, angularTolerance=0.05)\n`.trim()\n\n/** 01 — 100 x 60 x 20 block, four 8 mm through-holes, 2 mm top-perimeter chamfer. */\nconst CALIBRATION_BLOCK = `\n# Chamfer BEFORE the bores: \">Z\" selects the four top edges of the raw box, and\n# doing it first means the bore walls stay square, as the prompt requires.\nblock = cq.Workplane(\"XY\").box(100, 60, 20, centered=(True, True, False)).edges(\">Z\").chamfer(2)\nbores = group([rod(8, 22, (x, y, -1), (0, 0, 1)) for x in (-35, 35) for y in (-20, 20)])\nresult = shape(block.cut(bores))\n`.trim()\n\n/** 02 — OD 80 x 10 flange, 30 mm central bore, six 6 mm holes on a 60 mm bolt circle. */\nconst CIRCULAR_FLANGE = `\n# \"%CIRCLE\" is the two outside circular edges; the extruded cylinder's third edge\n# is its vertical seam LINE, which cannot be filleted.\nflange = cq.Workplane(\"XY\").circle(40).extrude(10).edges(\"%CIRCLE\").fillet(1.5)\ncuts = [rod(30, 12, (0, 0, -1), (0, 0, 1))]\ncuts += [rod(6, 12, polar(30, 60 * i) + (-1,), (0, 0, 1)) for i in range(6)]\nresult = shape(flange.cut(group(cuts)))\n`.trim()\n\n/** 03 — L bracket: 80 x 50 x 8 base, 80 x 8 x 50 back plate, 4 holes, 2 gussets. */\nconst L_BRACKET = `\n# Base holes are cut into the base ALONE, before the gussets arrive. The gussets\n# stand on the base top at X = +/-20 (16..24) and the bores sit at X = +/-25\n# (22..28), so cutting after the union would notch a gusset; cutting first leaves\n# the removed volume exactly pi * 3^2 * 8 per bore.\nbase = cq.Workplane(\"XY\").box(80, 50, 8, centered=(True, True, False))\nbase = base.cut(group([rod(6, 10, (x, -10, -1), (0, 0, 1)) for x in (-25, 25)]))\n\n# Back plate hugs the rear edge: 8 mm thick in Y at Y = 17..25, rising 50 mm from\n# the base top (Z = 8..58).\nback = cq.Workplane(\"XY\").box(80, 8, 50, centered=(True, True, False)).translate((0, 21, 8))\n\n# Gussets: right triangle 30 tall x 30 deep in the (Y, Z) plane, 8 mm thick in X.\n# Workplane(\"YZ\") has local x = global Y, local y = global Z, normal = +X, so the\n# origin sits at the gusset's -X face and extrude(8) spans its thickness.\ngussets = [\n cq.Workplane(\"YZ\", origin=(x - 4, 0, 0)).polyline([(17, 8), (-13, 8), (17, 38)]).close().extrude(8)\n for x in (-20, 20)\n]\n\npart = cq.Workplane(obj=fuse_all([base, back] + gussets)).clean()\n# The one outside corner of the L: the X-running edge at the rear face (max Y),\n# lowest Z. Every other max-Y edge is higher, so the pair is unique.\npart = part.edges(\">Y and <Z\").fillet(2)\nresult = shape(part.cut(group([rod(6, 12, (x, 15, 30), (0, 1, 0)) for x in (-25, 25)])))\n`.trim()\n\n/** 04 — stepped shaft along X with 1 mm end chamfers and a top keyway. */\nconst STEPPED_SHAFT_KEYWAY = `\nshaft = cq.Workplane(obj=fuse_all([\n rod(20, 30, (0, 0, 0), (1, 0, 0)),\n rod(30, 60, (30, 0, 0), (1, 0, 0)),\n rod(20, 30, (90, 0, 0), (1, 0, 0)),\n])).clean()\n# Only the two end circles have an extreme X centre; the step circles sit at\n# X = 30 / 90 and the seam lines at the mid-point of their own segment.\nshaft = shaft.edges(\"<X or >X\").chamfer(1)\n# Keyway: 6 mm wide in Y, 3 mm deep from the Z = 15 top, running X = 40..80.\nkeyway = cq.Workplane(\"XY\").box(40, 6, 5, centered=(False, True, False)).translate((40, 0, 12))\nresult = shape(shaft.cut(keyway))\n`.trim()\n\n/** 05 — open-top enclosure, 3 mm walls/floor, four standoffs with blind holes. */\nconst OPEN_TOP_ELECTRONICS_ENCLOSURE = `\nouter = cq.Workplane(\"XY\").box(100, 70, 30, centered=(True, True, False)).edges(\"|Z\").fillet(2)\n# Cavity: 3 mm walls, 3 mm floor, open at the top (the cutter runs past Z = 30).\ncavity = cq.Workplane(\"XY\").box(94, 64, 31, centered=(True, True, False)).translate((0, 0, 3))\nshell = outer.cut(cavity)\n\n# Standoffs rise from the inside floor (Z = 3) 12 mm to Z = 15; each blind hole is\n# 3 mm across and 8 mm deep measured down from that top.\nposts = [\n rod(10, 12, (x, y, 3), (0, 0, 1)).cut(rod(3, 8, (x, y, 7), (0, 0, 1)))\n for x in (-35, 35)\n for y in (-25, 25)\n]\nresult = shape(shell.union(group(posts)))\n`.trim()\n\n/** 06 — clevis bracket: base plate, two lugs with a 14 mm pin bore, ribs, cutouts. */\nconst CLEVIS_BRACKET = `\nbase = cq.Workplane(\"XY\").box(120, 60, 10, centered=(True, True, False)).edges(\"|Z\").fillet(3)\n\n# Each lug is an (X, Z) side profile 18 mm thick in Y. Workplane(\"XZ\") has local\n# x = global X, local y = global Z and normal = -Y, so an origin at the lug's\n# +Y face plus extrude(18) lands on 8..26 / -26..-8, i.e. the stated 16 mm gap.\n# Straight part Z = 10..34, semicircular cap r = 18 about Z = 34 -> top at Z = 52,\n# exactly 42 mm above the base as the prompt states.\nbodies = [base]\nfor y_face in (26, -8):\n bodies.append(\n cq.Workplane(\"XZ\", origin=(0, y_face, 0)).moveTo(0, 10).rect(36, 24, centered=(True, False)).extrude(18)\n )\n bodies.append(rod(36, 18, (0, y_face, 34), (0, -1, 0)))\n# Diagonal reinforcing ribs, 6 mm thick in Y, lying against each lug's outer face.\nfor y_face in (26, -20):\n bodies.append(\n cq.Workplane(\"XZ\", origin=(0, y_face, 0)).polyline([(18, 10), (40, 10), (18, 34)]).close().extrude(6)\n )\n\npart = cq.Workplane(obj=fuse_all(bodies)).clean()\n# 2 mm fillets at the lug/rib-to-base transitions. Filleting BEFORE the cuts keeps\n# the selector honest: the only edges left in this box are the lug and rib feet\n# (the base perimeter is at |X| = 60 / |Y| = 30, outside it).\npart = part.edges(cq.selectors.BoxSelector((-42, -29, 9.5), (42, 29, 10.5))).fillet(2)\n\ncuts = [rod(14, 60, (0, -30, 34), (0, 1, 0))]\ncuts += [rod(7, 12, (x, y, -1), (0, 0, 1)) for x in (-45, 45) for y in (-20, 20)]\n# Triangular lightening cutouts through the base web, corners rounded 3 mm.\ncuts += [\n cq.Workplane(\"XY\", origin=(sx * 31, 0, -1))\n .polyline([(6, 0), (-3, 5.2), (-3, -5.2)])\n .close()\n .offset2D(3)\n .extrude(12)\n for sx in (-1, 1)\n]\nresult = shape(part.cut(group(cuts)))\n`.trim()\n\n/** 07 — radial engine cylinder: barrel, 12 fins, base flange, top cap, plug boss. */\nconst RADIAL_ENGINE_CYLINDER = `\n# One cooling fin is a 2 mm disc of radius 30 plus a torus of tube radius 1 riding\n# its rim, so the fin outside diameter is 2 * (30 + 1) = 62 mm with the stated\n# 1 mm round already on the outer edge. Filleting a 2 mm disc by 1 mm instead\n# would need both fillets to meet tangentially at mid-height.\nparts = [rod(36, 70, (0, 0, 0), (0, 0, 1))]\nfor i in range(12):\n z = 10 + 5 * i\n parts.append(rod(60, 2, (0, 0, z), (0, 0, 1)))\n parts.append(cq.Solid.makeTorus(30, 1, cq.Vector(0, 0, z + 1), cq.Vector(0, 0, 1)))\n\n# Base flange OD 70 x 8 with 1 mm rounds on both outer circular edges: the round\n# eats inward, so the maximum radius stays exactly 35.\nparts.append(cq.Workplane(\"XY\").circle(35).extrude(8).edges(\"%CIRCLE\").fillet(1))\nparts.append(rod(44, 8, (0, 0, 70), (0, 0, 1)))\n\n# Spark-plug boss: 12 mm dia, 24 mm long, 35 degrees above horizontal, pointing\n# +X, rooted inside the top cap so it fuses with it.\nboss_dir = (math.cos(math.radians(35)), 0.0, math.sin(math.radians(35)))\nparts.append(rod(12, 24, (10, 0, 72), boss_dir))\n\ncuts = [rod(5, 10, polar(28, 60 * i) + (-1,), (0, 0, 1)) for i in range(6)]\ncuts.append(rod(5, 25, (10, 0, 72), boss_dir))\nresult = fuse_all(parts).cut(group(cuts))\n`.trim()\n\n/** 08 — centrifugal impeller: backplate, hub, 12 backward-curved blades, bore. */\nconst CENTRIFUGAL_IMPELLER = `\n# Blade centreline: radius 18 -> 43 while sweeping 45 degrees backward (clockwise\n# seen from above, so the tips lean against counter-clockwise rotation). The\n# outline is that centreline offset +/-1.5 mm along its own normal, so the blade\n# is 3 mm thick everywhere and the ends are flat caps.\nBLADE_HALF = 1.5\n\n\ndef blade_outline(steps=32):\n dr = 25.0\n dth = math.radians(-45.0)\n left, right = [], []\n for i in range(steps + 1):\n t = i / float(steps)\n r = 18.0 + dr * t\n th = dth * t\n c, s = math.cos(th), math.sin(th)\n px, py = r * c, r * s\n dx = dr * c - r * dth * s\n dy = dr * s + r * dth * c\n n = math.hypot(dx, dy)\n nx, ny = -dy / n, dx / n\n left.append((px + BLADE_HALF * nx, py + BLADE_HALF * ny))\n right.append((px - BLADE_HALF * nx, py - BLADE_HALF * ny))\n return left + right[::-1]\n\n\nblade = cq.Workplane(\"XY\", origin=(0, 0, 6)).polyline(blade_outline()).close().extrude(16).val()\n\n# Backplate OD 90 x 6 with 1.5 mm rounds on both outer circular edges, then the\n# hub. The prompt's own radii leave a 5 mm gap between the blade roots (r = 18)\n# and the hub (r = 13), so the stated blade-to-hub root fillet has nothing to\n# fillet and is omitted; the blades still fuse to the backplate they stand on.\nparts = [\n cq.Workplane(\"XY\").circle(45).extrude(6).edges(\"%CIRCLE\").fillet(1.5),\n rod(26, 22, (0, 0, 6), (0, 0, 1)),\n]\nparts += [blade.rotate((0, 0, 0), (0, 0, 1), 30 * i) for i in range(12)]\nresult = fuse_all(parts).cut(rod(8, 30, (0, 0, -1), (0, 0, 1)))\n`.trim()\n\n/** 09 — spiral staircase: column, 20 helical treads, helical handrail, balusters. */\nconst SPIRAL_STAIRCASE = `\nN = 20\nZ0 = 4.0 # first tread bottom\nRISE = 6.0 # Z step per tread\nTURN = 18.0 # degrees per tread\nRAIL_R = 66.0\nRAIL_Z0 = 14.0\nRAIL_Z1 = 130.0\n\n\ndef rail_z(deg):\n \"\"\"Handrail centreline height at a plan angle, counter-clockwise from +X.\"\"\"\n return RAIL_Z0 + (RAIL_Z1 - RAIL_Z0) * deg / 360.0\n\n\ndef tread(a0, z, ri=10.0, ro=62.0, ang=24.0, h=4.0, m=24):\n pts = [polar(ri, a0 + ang * i / m) for i in range(m + 1)]\n pts += [polar(ro, a0 + ang * (m - i) / m) for i in range(m + 1)]\n return cq.Workplane(\"XY\", origin=(0, 0, z)).polyline(pts).close().extrude(h)\n\n\nparts = [\n rod(14, 140, (0, 0, 0), (0, 0, 1)), # central column\n rod(90, 5, (0, 0, 0), (0, 0, 1)), # base disk, Z = 0..5, catches tread 1\n]\nfor k in range(N):\n a0 = TURN * k\n z0 = Z0 + RISE * k\n parts.append(tread(a0, z0))\n # Baluster at the tread's outer end, mid-width, rising to the handrail centre.\n a_b = a0 + 12.0\n parts.append(rod(3, rail_z(a_b) - z0, polar(63, a_b) + (z0,), (0, 0, 1)))\n\n# Helical handrail: a 5 mm circle swept along one counter-clockwise turn at\n# radius 66, rising Z = 14 -> 130.\npath = cq.Workplane(\"XY\").add(cq.Wire.makeHelix(RAIL_Z1 - RAIL_Z0, RAIL_Z1 - RAIL_Z0, RAIL_R, cq.Vector(0, 0, RAIL_Z0)))\nparts.append(cq.Workplane(\"XZ\", origin=(0, 0, RAIL_Z0)).center(RAIL_R, 0).circle(2.5).sweep(path, isFrenet=True))\n\nresult = fuse_all(parts)\n`.trim()\n\n/** 10 — planetary gear stage: 9 separate bodies (sun, 3 planets, ring, carrier, 3 pins). */\nconst PLANETARY_GEAR_STAGE = `\nGZ = 16.0 # gear underside; the pins (Z = 0..14) stop 2 mm short of it\nGT = 8.0 # gear thickness\n\n\ndef gear_polygon(n, r_root, r_tip, ha_root, ha_tip, phase, arc_steps=4):\n \"\"\"One closed outline for a straight-sided trapezoidal-tooth gear: each tooth\n is four points between the root and tip circles, joined by chorded root arcs.\n One polygon, so no boolean per tooth. Works for an external gear (r_tip >\n r_root) and for the bore of an internal one (r_tip < r_root) unchanged.\"\"\"\n pts = []\n step = 360.0 / n\n for i in range(n):\n a = phase + step * i\n pts.append(polar(r_root, a - ha_root))\n pts.append(polar(r_tip, a - ha_tip))\n pts.append(polar(r_tip, a + ha_tip))\n pts.append(polar(r_root, a + ha_root))\n start, end = a + ha_root, a + step - ha_root\n for s in range(1, arc_steps):\n pts.append(polar(r_root, start + (end - start) * s / arc_steps))\n return pts\n\n\ndef prism(points, z, thickness):\n return cq.Workplane(\"XY\", origin=(0, 0, z)).polyline(points).close().extrude(thickness).val()\n\n\n# Sun: 24 teeth, root d42, OD 54, central bore d10. Phase 7.5 puts a tooth SPACE\n# on each of the three planet directions (0 / 120 / 240 deg), the only phase where\n# the sun tip circle clears the planet root circles at all.\nsun = prism(gear_polygon(24, 21, 27, 4, 0.2, 7.5), GZ, GT).cut(rod(10, 10, (0, 0, GZ - 1), (0, 0, 1)))\n\n# Three planets: 18 teeth, root d31, OD 41, centres on r = 42 every 120 degrees.\n# Phase 0 puts a tooth on the sun side (local 180) and on the ring side (local 0).\nplanet = prism(gear_polygon(18, 15.5, 20.5, 5, 2, 0), GZ, GT).translate(cq.Vector(42, 0, 0))\nplanets = [planet.rotate((0, 0, 0), (0, 0, 1), 120 * i) for i in range(3)]\n\n# Ring: 60 internal teeth, OD 140, internal root d126.\n# DEVIATION (inherited verbatim from the v1 gold): internal tooth-tip diameter is\n# 116, not the prompt's 114. At 114 the ring tooth tips sit at r = 57 while the\n# planet ROOT circles reach 42 + 15.5 = 57.5, so every planet overlaps every ring\n# tooth and the required nine separate bodies cannot exist at any phase or\n# rotation. 116 restores 0.5 mm of tip clearance and leaves every other stated\n# diameter untouched.\nring = cq.Workplane(\"XY\", origin=(0, 0, GZ)).circle(70).extrude(GT).val()\nring = ring.cut(prism(gear_polygon(60, 63, 58, 1.5, 1.0, 3, arc_steps=2), GZ - 1, GT + 2))\n\ncarrier = rod(105, 4, (0, 0, -5), (0, 0, 1))\npins = [rod(6, 14, polar(42, 120 * i) + (0,), (0, 0, 1)) for i in range(3)]\n\nresult = group([sun] + planets + [ring, carrier] + pins)\n`.trim()\n\nconst BODIES: Record<string, string> = {\n 'calibration-block': CALIBRATION_BLOCK,\n 'circular-flange': CIRCULAR_FLANGE,\n 'l-bracket': L_BRACKET,\n 'stepped-shaft-keyway': STEPPED_SHAFT_KEYWAY,\n 'open-top-electronics-enclosure': OPEN_TOP_ELECTRONICS_ENCLOSURE,\n 'clevis-bracket-lightening-cutouts': CLEVIS_BRACKET,\n 'radial-engine-cylinder': RADIAL_ENGINE_CYLINDER,\n 'centrifugal-impeller': CENTRIFUGAL_IMPELLER,\n 'spiral-staircase': SPIRAL_STAIRCASE,\n 'planetary-gear-stage': PLANETARY_GEAR_STAGE,\n}\n\n/** Gold CadQuery script per task id — preamble, body, then the two export lines. */\nexport const MCAD_CQ_GOLDS: Record<string, string> = Object.fromEntries(\n Object.entries(BODIES).map(([id, body]) => [id, `${PREAMBLE}\\n\\n${body}\\n\\n${EXPORT}\\n`]),\n)\n\n/**\n * Task ids whose CadQuery gold does NOT reach 1.0 through this adapter. Empty\n * means every gold calibrates; an entry here is a promise that the spec was left\n * alone and the gold is the thing that fell short, with the failing check named in\n * a comment on the body above.\n */\nexport const MCAD_CQ_UNCALIBRATED: ReadonlySet<string> = new Set<string>()\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8Bf,KAAK;;AAGP,MAAM,SAAS;;;EAGb,KAAK;AAgSP,MAAM,SAAiC;CACrC,qBA9RwB;;;;;;EAMxB,KAwRqC;CACrC,mBAtRsB;;;;;;;EAOtB,KA+QiC;CACjC,aA7QgB;;;;;;;;;;;;;;;;;;;;;;;;;EAyBhB,KAoPqB;CACrB,wBAlP2B;;;;;;;;;;;;EAY3B,KAsO2C;CAC3C,kCApOqC;;;;;;;;;;;;;;EAcrC,KAsN+D;CAC/D,qCApNqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsCrB,KA8KkD;CAClD,0BA5K6B;;;;;;;;;;;;;;;;;;;;;;;;EAwB7B,KAoJ+C;CAC/C,wBAlJ2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuC3B,KA2G2C;CAC3C,oBAzGuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCvB,KAkEmC;CACnC,wBAhE2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoD3B,KAY2C;AAC7C;;AAGA,MAAa,gBAAwC,OAAO,YAC1D,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC,IAAI,GAAG,SAAS,MAAM,KAAK,MAAM,OAAO,GAAG,CAAC,CAC1F;;;;;;;AAQA,MAAa,uCAA4C,IAAI,IAAY"}
1
+ {"version":3,"file":"mcad-cq-golds.js","names":[],"sources":["../../src/benchmarks/mcad-cq-golds.ts"],"sourcesContent":["/**\n * MCAD-CQ gold oracles — one Python CadQuery script per task in `mcad-tasks.ts`.\n *\n * These are CALIBRATION artifacts, not exemplar answers: their whole job is to\n * prove this adapter's accept direction fires. Every one has been run through\n * `createMcadCqAdapter().evaluate()` on this host, and a task is reported calibrated\n * only when its gold below scores 1.0 — including the `stepEmitted` check, so\n * every gold really does write a STEP file, which is the deviation v1 could not\n * close.\n *\n * They are written plain and share one preamble of four helpers. Two of those\n * helpers are not stylistic:\n * - `fuse_all` runs ONE multi-argument boolean instead of N sequential unions\n * on a growing solid. OCC's cost is superlinear in the accumulated face\n * count, and the fin stack (task 07), the staircase (task 09) and the blade\n * ring (task 08) all miss the judge's 120 s deadline the sequential way.\n * - `group` builds a compound of DISJOINT cutters, so a four-bore cut is one\n * boolean rather than four.\n *\n * Where a gold deviates from the prompt's literal dimensions the deviation is\n * named in a comment at the point of the deviation, with the reason. There is one,\n * inherited verbatim from v1: task 10's ring tooth-tip diameter.\n */\n\n/** Imports plus the four helpers every gold below uses. */\nconst PREAMBLE = `\nimport math\nimport cadquery as cq\n\n\ndef shape(s):\n \"\"\"Unwrap a Workplane to the Shape it holds; pass Shapes through unchanged.\"\"\"\n return s.val() if isinstance(s, cq.Workplane) else s\n\n\ndef rod(d, length, base, direction):\n \"\"\"Cylinder of diameter d, \\`length\\` long, from \\`base\\` along \\`direction\\`.\"\"\"\n return cq.Solid.makeCylinder(d / 2.0, length, cq.Vector(*base), cq.Vector(*direction))\n\n\ndef polar(r, deg):\n \"\"\"(x, y) at radius r and angle deg, counter-clockwise from +X.\"\"\"\n a = math.radians(deg)\n return (r * math.cos(a), r * math.sin(a))\n\n\ndef group(shapes):\n \"\"\"Disjoint shapes as one compound: no boolean, so no OCC cost.\"\"\"\n return cq.Compound.makeCompound([shape(s) for s in shapes])\n\n\ndef fuse_all(parts):\n \"\"\"ONE multi-argument boolean instead of N unions on a growing solid.\"\"\"\n xs = [shape(p) for p in parts]\n return xs[0] if len(xs) == 1 else xs[0].fuse(*xs[1:])\n`.trim()\n\n/** The two export lines the prompt pins, verbatim. */\nconst EXPORT = `\ncq.exporters.export(result, \"part.step\")\ncq.exporters.export(result, \"part.stl\", exportType=\"STL\", opt={\"ascii\": True}, tolerance=0.01, angularTolerance=0.05)\n`.trim()\n\n/** 01 — 100 x 60 x 20 block, four 8 mm through-holes, 2 mm top-perimeter chamfer. */\nconst CALIBRATION_BLOCK = `\n# Chamfer BEFORE the bores: \">Z\" selects the four top edges of the raw box, and\n# doing it first means the bore walls stay square, as the prompt requires.\nblock = cq.Workplane(\"XY\").box(100, 60, 20, centered=(True, True, False)).edges(\">Z\").chamfer(2)\nbores = group([rod(8, 22, (x, y, -1), (0, 0, 1)) for x in (-35, 35) for y in (-20, 20)])\nresult = shape(block.cut(bores))\n`.trim()\n\n/** 02 — OD 80 x 10 flange, 30 mm central bore, six 6 mm holes on a 60 mm bolt circle. */\nconst CIRCULAR_FLANGE = `\n# \"%CIRCLE\" is the two outside circular edges; the extruded cylinder's third edge\n# is its vertical seam LINE, which cannot be filleted.\nflange = cq.Workplane(\"XY\").circle(40).extrude(10).edges(\"%CIRCLE\").fillet(1.5)\ncuts = [rod(30, 12, (0, 0, -1), (0, 0, 1))]\ncuts += [rod(6, 12, polar(30, 60 * i) + (-1,), (0, 0, 1)) for i in range(6)]\nresult = shape(flange.cut(group(cuts)))\n`.trim()\n\n/** 03 — L bracket: 80 x 50 x 8 base, 80 x 8 x 50 back plate, 4 holes, 2 gussets. */\nconst L_BRACKET = `\n# Base holes are cut into the base ALONE, before the gussets arrive. The gussets\n# stand on the base top at X = +/-20 (16..24) and the bores sit at X = +/-25\n# (22..28), so cutting after the union would notch a gusset; cutting first leaves\n# the removed volume exactly pi * 3^2 * 8 per bore.\nbase = cq.Workplane(\"XY\").box(80, 50, 8, centered=(True, True, False))\nbase = base.cut(group([rod(6, 10, (x, -10, -1), (0, 0, 1)) for x in (-25, 25)]))\n\n# Back plate hugs the rear edge: 8 mm thick in Y at Y = 17..25, rising 50 mm from\n# the base top (Z = 8..58).\nback = cq.Workplane(\"XY\").box(80, 8, 50, centered=(True, True, False)).translate((0, 21, 8))\n\n# Gussets: right triangle 30 tall x 30 deep in the (Y, Z) plane, 8 mm thick in X.\n# Workplane(\"YZ\") has local x = global Y, local y = global Z, normal = +X, so the\n# origin sits at the gusset's -X face and extrude(8) spans its thickness.\ngussets = [\n cq.Workplane(\"YZ\", origin=(x - 4, 0, 0)).polyline([(17, 8), (-13, 8), (17, 38)]).close().extrude(8)\n for x in (-20, 20)\n]\n\npart = cq.Workplane(obj=fuse_all([base, back] + gussets)).clean()\n# The one outside corner of the L: the X-running edge at the rear face (max Y),\n# lowest Z. Every other max-Y edge is higher, so the pair is unique.\npart = part.edges(\">Y and <Z\").fillet(2)\nresult = shape(part.cut(group([rod(6, 12, (x, 15, 30), (0, 1, 0)) for x in (-25, 25)])))\n`.trim()\n\n/** 04 — stepped shaft along X with 1 mm end chamfers and a top keyway. */\nconst STEPPED_SHAFT_KEYWAY = `\nshaft = cq.Workplane(obj=fuse_all([\n rod(20, 30, (0, 0, 0), (1, 0, 0)),\n rod(30, 60, (30, 0, 0), (1, 0, 0)),\n rod(20, 30, (90, 0, 0), (1, 0, 0)),\n])).clean()\n# Only the two end circles have an extreme X centre; the step circles sit at\n# X = 30 / 90 and the seam lines at the mid-point of their own segment.\nshaft = shaft.edges(\"<X or >X\").chamfer(1)\n# Keyway: 6 mm wide in Y, 3 mm deep from the Z = 15 top, running X = 40..80.\nkeyway = cq.Workplane(\"XY\").box(40, 6, 5, centered=(False, True, False)).translate((40, 0, 12))\nresult = shape(shaft.cut(keyway))\n`.trim()\n\n/** 05 — open-top enclosure, 3 mm walls/floor, four standoffs with blind holes. */\nconst OPEN_TOP_ELECTRONICS_ENCLOSURE = `\nouter = cq.Workplane(\"XY\").box(100, 70, 30, centered=(True, True, False)).edges(\"|Z\").fillet(2)\n# Cavity: 3 mm walls, 3 mm floor, open at the top (the cutter runs past Z = 30).\ncavity = cq.Workplane(\"XY\").box(94, 64, 31, centered=(True, True, False)).translate((0, 0, 3))\nshell = outer.cut(cavity)\n\n# Standoffs rise from the inside floor (Z = 3) 12 mm to Z = 15; each blind hole is\n# 3 mm across and 8 mm deep measured down from that top.\nposts = [\n rod(10, 12, (x, y, 3), (0, 0, 1)).cut(rod(3, 8, (x, y, 7), (0, 0, 1)))\n for x in (-35, 35)\n for y in (-25, 25)\n]\nresult = shape(shell.union(group(posts)))\n`.trim()\n\n/** 06 — clevis bracket: base plate, two lugs with a 14 mm pin bore, ribs, cutouts. */\nconst CLEVIS_BRACKET = `\nbase = cq.Workplane(\"XY\").box(120, 60, 10, centered=(True, True, False)).edges(\"|Z\").fillet(3)\n\n# Each lug is an (X, Z) side profile 18 mm thick in Y. Workplane(\"XZ\") has local\n# x = global X, local y = global Z and normal = -Y, so an origin at the lug's\n# +Y face plus extrude(18) lands on 8..26 / -26..-8, i.e. the stated 16 mm gap.\n# Straight part Z = 10..34, semicircular cap r = 18 about Z = 34 -> top at Z = 52,\n# exactly 42 mm above the base as the prompt states.\nbodies = [base]\nfor y_face in (26, -8):\n bodies.append(\n cq.Workplane(\"XZ\", origin=(0, y_face, 0)).moveTo(0, 10).rect(36, 24, centered=(True, False)).extrude(18)\n )\n bodies.append(rod(36, 18, (0, y_face, 34), (0, -1, 0)))\n# Diagonal reinforcing ribs, 6 mm thick in Y, lying against each lug's outer face.\nfor y_face in (26, -20):\n bodies.append(\n cq.Workplane(\"XZ\", origin=(0, y_face, 0)).polyline([(18, 10), (40, 10), (18, 34)]).close().extrude(6)\n )\n\npart = cq.Workplane(obj=fuse_all(bodies)).clean()\n# 2 mm fillets at the lug/rib-to-base transitions. Filleting BEFORE the cuts keeps\n# the selector honest: the only edges left in this box are the lug and rib feet\n# (the base perimeter is at |X| = 60 / |Y| = 30, outside it).\npart = part.edges(cq.selectors.BoxSelector((-42, -29, 9.5), (42, 29, 10.5))).fillet(2)\n\ncuts = [rod(14, 60, (0, -30, 34), (0, 1, 0))]\ncuts += [rod(7, 12, (x, y, -1), (0, 0, 1)) for x in (-45, 45) for y in (-20, 20)]\n# Triangular lightening cutouts through the base web, corners rounded 3 mm.\ncuts += [\n cq.Workplane(\"XY\", origin=(sx * 31, 0, -1))\n .polyline([(6, 0), (-3, 5.2), (-3, -5.2)])\n .close()\n .offset2D(3)\n .extrude(12)\n for sx in (-1, 1)\n]\nresult = shape(part.cut(group(cuts)))\n`.trim()\n\n/** 07 — radial engine cylinder: barrel, 12 fins, base flange, top cap, plug boss. */\nconst RADIAL_ENGINE_CYLINDER = `\n# One cooling fin is a 2 mm disc of radius 30 plus a torus of tube radius 1 riding\n# its rim, so the fin outside diameter is 2 * (30 + 1) = 62 mm with the stated\n# 1 mm round already on the outer edge. Filleting a 2 mm disc by 1 mm instead\n# would need both fillets to meet tangentially at mid-height.\nparts = [rod(36, 70, (0, 0, 0), (0, 0, 1))]\nfor i in range(12):\n z = 10 + 5 * i\n parts.append(rod(60, 2, (0, 0, z), (0, 0, 1)))\n parts.append(cq.Solid.makeTorus(30, 1, cq.Vector(0, 0, z + 1), cq.Vector(0, 0, 1)))\n\n# Base flange OD 70 x 8 with 1 mm rounds on both outer circular edges: the round\n# eats inward, so the maximum radius stays exactly 35.\nparts.append(cq.Workplane(\"XY\").circle(35).extrude(8).edges(\"%CIRCLE\").fillet(1))\nparts.append(rod(44, 8, (0, 0, 70), (0, 0, 1)))\n\n# Spark-plug boss: 12 mm dia, 24 mm long, 35 degrees above horizontal, pointing\n# +X, rooted inside the top cap so it fuses with it.\nboss_dir = (math.cos(math.radians(35)), 0.0, math.sin(math.radians(35)))\nparts.append(rod(12, 24, (10, 0, 72), boss_dir))\n\ncuts = [rod(5, 10, polar(28, 60 * i) + (-1,), (0, 0, 1)) for i in range(6)]\ncuts.append(rod(5, 25, (10, 0, 72), boss_dir))\nresult = fuse_all(parts).cut(group(cuts))\n`.trim()\n\n/** 08 — centrifugal impeller: backplate, hub, 12 backward-curved blades, bore. */\nconst CENTRIFUGAL_IMPELLER = `\n# Blade centreline: radius 18 -> 43 while sweeping 45 degrees backward (clockwise\n# seen from above, so the tips lean against counter-clockwise rotation). The\n# outline is that centreline offset +/-1.5 mm along its own normal, so the blade\n# is 3 mm thick everywhere and the ends are flat caps.\nBLADE_HALF = 1.5\n\n\ndef blade_outline(steps=32):\n dr = 25.0\n dth = math.radians(-45.0)\n left, right = [], []\n for i in range(steps + 1):\n t = i / float(steps)\n r = 18.0 + dr * t\n th = dth * t\n c, s = math.cos(th), math.sin(th)\n px, py = r * c, r * s\n dx = dr * c - r * dth * s\n dy = dr * s + r * dth * c\n n = math.hypot(dx, dy)\n nx, ny = -dy / n, dx / n\n left.append((px + BLADE_HALF * nx, py + BLADE_HALF * ny))\n right.append((px - BLADE_HALF * nx, py - BLADE_HALF * ny))\n return left + right[::-1]\n\n\nblade = cq.Workplane(\"XY\", origin=(0, 0, 6)).polyline(blade_outline()).close().extrude(16).val()\n\n# Backplate OD 90 x 6 with 1.5 mm rounds on both outer circular edges, then the\n# hub. The prompt's own radii leave a 5 mm gap between the blade roots (r = 18)\n# and the hub (r = 13), so the stated blade-to-hub root fillet has nothing to\n# fillet and is omitted; the blades still fuse to the backplate they stand on.\nparts = [\n cq.Workplane(\"XY\").circle(45).extrude(6).edges(\"%CIRCLE\").fillet(1.5),\n rod(26, 22, (0, 0, 6), (0, 0, 1)),\n]\nparts += [blade.rotate((0, 0, 0), (0, 0, 1), 30 * i) for i in range(12)]\nresult = fuse_all(parts).cut(rod(8, 30, (0, 0, -1), (0, 0, 1)))\n`.trim()\n\n/** 09 — spiral staircase: column, 20 helical treads, helical handrail, balusters. */\nconst SPIRAL_STAIRCASE = `\nN = 20\nZ0 = 4.0 # first tread bottom\nRISE = 6.0 # Z step per tread\nTURN = 18.0 # degrees per tread\nRAIL_R = 66.0\nRAIL_Z0 = 14.0\nRAIL_Z1 = 130.0\n\n\ndef rail_z(deg):\n \"\"\"Handrail centreline height at a plan angle, counter-clockwise from +X.\"\"\"\n return RAIL_Z0 + (RAIL_Z1 - RAIL_Z0) * deg / 360.0\n\n\ndef tread(a0, z, ri=10.0, ro=62.0, ang=24.0, h=4.0, m=24):\n pts = [polar(ri, a0 + ang * i / m) for i in range(m + 1)]\n pts += [polar(ro, a0 + ang * (m - i) / m) for i in range(m + 1)]\n return cq.Workplane(\"XY\", origin=(0, 0, z)).polyline(pts).close().extrude(h)\n\n\nparts = [\n rod(14, 140, (0, 0, 0), (0, 0, 1)), # central column\n rod(90, 5, (0, 0, 0), (0, 0, 1)), # base disk, Z = 0..5, catches tread 1\n]\nfor k in range(N):\n a0 = TURN * k\n z0 = Z0 + RISE * k\n parts.append(tread(a0, z0))\n # Baluster at the tread's outer end, mid-width, rising to the handrail centre.\n a_b = a0 + 12.0\n parts.append(rod(3, rail_z(a_b) - z0, polar(63, a_b) + (z0,), (0, 0, 1)))\n\n# Helical handrail: a 5 mm circle swept along one counter-clockwise turn at\n# radius 66, rising Z = 14 -> 130.\npath = cq.Workplane(\"XY\").add(cq.Wire.makeHelix(RAIL_Z1 - RAIL_Z0, RAIL_Z1 - RAIL_Z0, RAIL_R, cq.Vector(0, 0, RAIL_Z0)))\nparts.append(cq.Workplane(\"XZ\", origin=(0, 0, RAIL_Z0)).center(RAIL_R, 0).circle(2.5).sweep(path, isFrenet=True))\n\nresult = fuse_all(parts)\n`.trim()\n\n/** 10 — planetary gear stage: 9 separate bodies (sun, 3 planets, ring, carrier, 3 pins). */\nconst PLANETARY_GEAR_STAGE = `\nGZ = 16.0 # gear underside; the pins (Z = 0..14) stop 2 mm short of it\nGT = 8.0 # gear thickness\n\n\ndef gear_polygon(n, r_root, r_tip, ha_root, ha_tip, phase, arc_steps=4):\n \"\"\"One closed outline for a straight-sided trapezoidal-tooth gear: each tooth\n is four points between the root and tip circles, joined by chorded root arcs.\n One polygon, so no boolean per tooth. Works for an external gear (r_tip >\n r_root) and for the bore of an internal one (r_tip < r_root) unchanged.\"\"\"\n pts = []\n step = 360.0 / n\n for i in range(n):\n a = phase + step * i\n pts.append(polar(r_root, a - ha_root))\n pts.append(polar(r_tip, a - ha_tip))\n pts.append(polar(r_tip, a + ha_tip))\n pts.append(polar(r_root, a + ha_root))\n start, end = a + ha_root, a + step - ha_root\n for s in range(1, arc_steps):\n pts.append(polar(r_root, start + (end - start) * s / arc_steps))\n return pts\n\n\ndef prism(points, z, thickness):\n return cq.Workplane(\"XY\", origin=(0, 0, z)).polyline(points).close().extrude(thickness).val()\n\n\n# Sun: 24 teeth, root d42, OD 54, central bore d10. Phase 7.5 puts a tooth SPACE\n# on each of the three planet directions (0 / 120 / 240 deg), the only phase where\n# the sun tip circle clears the planet root circles at all.\nsun = prism(gear_polygon(24, 21, 27, 4, 0.2, 7.5), GZ, GT).cut(rod(10, 10, (0, 0, GZ - 1), (0, 0, 1)))\n\n# Three planets: 18 teeth, root d31, OD 41, centres on r = 42 every 120 degrees.\n# Phase 0 puts a tooth on the sun side (local 180) and on the ring side (local 0).\nplanet = prism(gear_polygon(18, 15.5, 20.5, 5, 2, 0), GZ, GT).translate(cq.Vector(42, 0, 0))\nplanets = [planet.rotate((0, 0, 0), (0, 0, 1), 120 * i) for i in range(3)]\n\n# Ring: 60 internal teeth, OD 140, internal root d126.\n# DEVIATION (inherited verbatim from the v1 gold): internal tooth-tip diameter is\n# 116, not the prompt's 114. At 114 the ring tooth tips sit at r = 57 while the\n# planet ROOT circles reach 42 + 15.5 = 57.5, so every planet overlaps every ring\n# tooth and the required nine separate bodies cannot exist at any phase or\n# rotation. 116 restores 0.5 mm of tip clearance and leaves every other stated\n# diameter untouched.\nring = cq.Workplane(\"XY\", origin=(0, 0, GZ)).circle(70).extrude(GT).val()\nring = ring.cut(prism(gear_polygon(60, 63, 58, 1.5, 1.0, 3, arc_steps=2), GZ - 1, GT + 2))\n\ncarrier = rod(105, 4, (0, 0, -5), (0, 0, 1))\npins = [rod(6, 14, polar(42, 120 * i) + (0,), (0, 0, 1)) for i in range(3)]\n\nresult = group([sun] + planets + [ring, carrier] + pins)\n`.trim()\n\nconst BODIES: Record<string, string> = {\n 'calibration-block': CALIBRATION_BLOCK,\n 'circular-flange': CIRCULAR_FLANGE,\n 'l-bracket': L_BRACKET,\n 'stepped-shaft-keyway': STEPPED_SHAFT_KEYWAY,\n 'open-top-electronics-enclosure': OPEN_TOP_ELECTRONICS_ENCLOSURE,\n 'clevis-bracket-lightening-cutouts': CLEVIS_BRACKET,\n 'radial-engine-cylinder': RADIAL_ENGINE_CYLINDER,\n 'centrifugal-impeller': CENTRIFUGAL_IMPELLER,\n 'spiral-staircase': SPIRAL_STAIRCASE,\n 'planetary-gear-stage': PLANETARY_GEAR_STAGE,\n}\n\n/** Gold CadQuery script per task id — preamble, body, then the two export lines. */\nexport const MCAD_CQ_GOLDS: Record<string, string> = Object.fromEntries(\n Object.entries(BODIES).map(([id, body]) => [id, `${PREAMBLE}\\n\\n${body}\\n\\n${EXPORT}\\n`]),\n)\n\n/**\n * Task ids whose CadQuery gold does NOT reach 1.0 through this adapter. Empty\n * means every gold calibrates; an entry here is a promise that the spec was left\n * alone and the gold is the thing that fell short, with the failing check named in\n * a comment on the body above.\n */\nexport const MCAD_CQ_UNCALIBRATED: ReadonlySet<string> = new Set<string>()\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8Bf,KAAK;;AAGP,MAAM,SAAS;;;EAGb,KAAK;AAgSP,MAAM,SAAiC;CACrC,qBA9RwB;;;;;;EAMxB,KAwRqC;CACrC,mBAtRsB;;;;;;;EAOtB,KA+QiC;CACjC,aA7QgB;;;;;;;;;;;;;;;;;;;;;;;;;EAyBhB,KAoPqB;CACrB,wBAlP2B;;;;;;;;;;;;EAY3B,KAsO2C;CAC3C,kCApOqC;;;;;;;;;;;;;;EAcrC,KAsN+D;CAC/D,qCApNqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsCrB,KA8KkD;CAClD,0BA5K6B;;;;;;;;;;;;;;;;;;;;;;;;EAwB7B,KAoJ+C;CAC/C,wBAlJ2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuC3B,KA2G2C;CAC3C,oBAzGuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCvB,KAkEmC;CACnC,wBAhE2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoD3B,KAY2C;AAC7C;;AAGA,MAAa,gBAAwC,OAAO,YAC1D,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC,IAAI,GAAG,SAAS,MAAM,KAAK,MAAM,OAAO,GAAG,CAAC,CAC1F;;;;;;;AAQA,MAAa,uCAA4C,IAAI,IAAY"}
@@ -4,7 +4,7 @@
4
4
  * These are CALIBRATION artifacts, not exemplar answers: their whole job is to
5
5
  * prove the judge's accept direction fires, so they are written plain (no clever
6
6
  * parametrics, `$fn=96` on round features) and every one of them has been run
7
- * through `createMcadBenchAdapter().judge()` on this host. A task is marked
7
+ * through `createMcadBenchAdapter().evaluate()` on this host. A task is marked
8
8
  * `calibrated: true` in `mcad-tasks.ts` only when its gold below scores 1.0.
9
9
  *
10
10
  * Where a gold deviates from the prompt's literal dimensions, the deviation is
@@ -1 +1 @@
1
- {"version":3,"file":"mcad-golds.js","names":[],"sources":["../../src/benchmarks/mcad-golds.ts"],"sourcesContent":["/**\n * MCAD gold oracles — one OpenSCAD model per task in `mcad-tasks.ts`.\n *\n * These are CALIBRATION artifacts, not exemplar answers: their whole job is to\n * prove the judge's accept direction fires, so they are written plain (no clever\n * parametrics, `$fn=96` on round features) and every one of them has been run\n * through `createMcadBenchAdapter().judge()` on this host. A task is marked\n * `calibrated: true` in `mcad-tasks.ts` only when its gold below scores 1.0.\n *\n * Where a gold deviates from the prompt's literal dimensions, the deviation is\n * named in a comment at the point of the deviation, with the reason. There is one\n * such deviation (task 10's ring tooth-tip diameter — the prompt's own numbers\n * make a coplanar 9-body assembly geometrically impossible; see the comment).\n */\n\n/** 01 — 100 x 60 x 20 block, four 8 mm through-holes, 2 mm top-perimeter chamfer. */\nconst CALIBRATION_BLOCK = `\n$fn=96;\n\n// The chamfer is the hull between the full-size body and a 2 mm inset top plate,\n// so it lands on the top perimeter only and leaves the bore walls square.\nmodule chamfered_block(l, w, h, c) {\n hull() {\n translate([-l/2, -w/2, 0]) cube([l, w, h - c]);\n translate([-l/2 + c, -w/2 + c, h - c]) cube([l - 2*c, w - 2*c, c]);\n }\n}\n\ndifference() {\n chamfered_block(100, 60, 20, 2);\n for (x = [-35, 35]) for (y = [-20, 20])\n translate([x, y, -1]) cylinder(h = 22, d = 8);\n}\n`.trim()\n\n/** 02 — OD 80 x 10 flange, 30 mm central bore, six 6 mm holes on a 60 mm bolt circle. */\nconst CIRCULAR_FLANGE = `\n$fn=96;\n\n// Revolved section: a 15..40 mm x 0..10 mm rectangle whose corners are rounded by\n// 1.5 mm (shrink then grow). That carries the required round on both outside\n// circular edges; the same round lands on the bore edges, which the prompt does\n// not ask for and does not forbid.\ndifference() {\n rotate_extrude()\n offset(r = 1.5) offset(delta = -1.5)\n polygon([[15, 0], [40, 0], [40, 10], [15, 10]]);\n for (i = [0:5]) rotate([0, 0, i * 60])\n translate([30, 0, -1]) cylinder(h = 12, d = 6);\n}\n`.trim()\n\n/** 03 — L bracket: 80 x 50 x 8 base, 80 x 8 x 50 back plate, 4 holes, 2 gussets. */\nconst L_BRACKET = `\n$fn=96;\n\n// The L is a (Y, Z) section extruded along X. rotate([90,0,90]) maps local\n// (x, y, z) to global (z, x, y), so a 2D point (y, z) extrudes along +X.\nr = 2; // round on the outside corner where the base and the back plate meet\narc = [for (i = [0:8]) [25 - r + r*cos(-90 + 90*i/8), r + r*sin(-90 + 90*i/8)]];\nsection = concat([[-25, 0], [25 - r, 0]], arc, [[25, 58], [17, 58], [17, 8], [-25, 8]]);\n\ndifference() {\n union() {\n translate([-40, 0, 0]) rotate([90, 0, 90]) linear_extrude(80) polygon(section);\n // gussets: right triangle 30 tall x 30 deep, 8 mm thick in X, at X = +/-20\n for (x = [-20, 20])\n translate([x - 4, 0, 0]) rotate([90, 0, 90]) linear_extrude(8)\n polygon([[17, 8], [-13, 8], [17, 38]]);\n }\n // base plate through-holes; the cutter stops flush at the base top (Z=8) so it\n // cannot notch the gussets that stand on that face\n for (x = [-25, 25]) translate([x, -10, -1]) cylinder(h = 9, d = 6);\n // back plate through-holes, along +Y through the 8 mm thickness\n for (x = [-25, 25]) translate([x, 17, 30]) rotate([-90, 0, 0]) cylinder(h = 9, d = 6);\n}\n`.trim()\n\n/** 04 — stepped shaft along X with 1 mm end chamfers and a top keyway. */\nconst STEPPED_SHAFT_KEYWAY = `\n$fn=96;\n\n// Every section is a cylinder laid along +X; the two end chamfers are 1 mm frusta.\nmodule seg(x, len, r1, r2) {\n translate([x, 0, 0]) rotate([0, 90, 0]) cylinder(h = len, r1 = r1, r2 = r2);\n}\n\ndifference() {\n union() {\n seg(0, 1, 9, 10);\n seg(1, 29, 10, 10);\n seg(30, 60, 15, 15);\n seg(90, 29, 10, 10);\n seg(119, 1, 10, 9);\n }\n // keyway: 6 mm wide in Y, 3 mm deep from the Z=15 top, X = 40..80\n translate([40, -3, 12]) cube([40, 6, 5]);\n}\n`.trim()\n\n/** 05 — open-top enclosure, 3 mm walls/floor, four standoffs with blind holes. */\nconst OPEN_TOP_ELECTRONICS_ENCLOSURE = `\n$fn=96;\n\n// Outer box with 2 mm rounds on the four vertical corners.\nmodule rounded_box(l, w, h, r) {\n hull() for (x = [-l/2 + r, l/2 - r]) for (y = [-w/2 + r, w/2 - r])\n translate([x, y, 0]) cylinder(h = h, r = r);\n}\n\nunion() {\n difference() {\n rounded_box(100, 70, 30, 2);\n // interior cavity: 3 mm walls, 3 mm floor, open at the top\n translate([-47, -32, 3]) cube([94, 64, 31]);\n }\n // standoffs rising from the inside floor, each with a 3 mm x 8 mm blind hole\n for (x = [-35, 35]) for (y = [-25, 25])\n translate([x, y, 3]) difference() {\n cylinder(h = 12, d = 10);\n translate([0, 0, 4]) cylinder(h = 9, d = 3);\n }\n}\n`.trim()\n\n/** 06 — clevis bracket: base plate, two lugs with a 14 mm pin bore, ribs, cutouts. */\nconst CLEVIS_BRACKET = `\n$fn=96;\n\n// Base plate, 3 mm rounds on the four vertical perimeter corners.\nmodule base_plate() {\n hull() for (x = [-57, 57]) for (y = [-27, 27])\n translate([x, y, 0]) cylinder(h = 10, r = 3);\n}\n\n// One clevis lug: an (X, Z) side profile extruded 18 mm in Y. The straight part\n// runs Z=10..34 and the semicircular cap is r=18 about Z=34, so the lug top is at\n// Z=52 -- exactly 42 mm above the base, as the prompt states.\nmodule lug() {\n translate([0, 26, 0]) rotate([90, 0, 0]) linear_extrude(18)\n union() {\n translate([-18, 10]) square([36, 24]);\n translate([0, 34]) circle(r = 18);\n }\n}\n\n// 2 mm transition flare where the lug foot meets the base plate.\nmodule lug_foot() {\n hull() {\n translate([-20, 6, 10]) cube([40, 22, 0.01]);\n translate([-18, 8, 12]) cube([36, 18, 0.01]);\n }\n}\n\n// Diagonal reinforcing rib, 6 mm thick in Y, lying against the lug's outer face.\nmodule rib() {\n translate([0, 26, 0]) rotate([90, 0, 0]) linear_extrude(6)\n polygon([[18, 10], [40, 10], [18, 34]]);\n}\n\ndifference() {\n union() {\n base_plate();\n lug(); mirror([0, 1, 0]) lug();\n lug_foot(); mirror([0, 1, 0]) lug_foot();\n rib(); mirror([0, 1, 0]) rib();\n }\n // clevis pin bore, 14 mm through both lugs along Y at X=0, Z=34\n translate([0, -27, 34]) rotate([-90, 0, 0]) cylinder(h = 54, d = 14);\n // four 7 mm base mounting holes\n for (x = [-45, 45]) for (y = [-20, 20])\n translate([x, y, -1]) cylinder(h = 12, d = 7);\n // triangular lightening cutouts through the base web, corners rounded 3 mm\n for (x = [-31, 31]) translate([x, 0, -1]) linear_extrude(12)\n offset(r = 3) polygon([[6, 0], [-3, 5.2], [-3, -5.2]]);\n}\n`.trim()\n\n/** 07 — radial engine cylinder: barrel, 12 fins, base flange, top cap, plug boss. */\nconst RADIAL_ENGINE_CYLINDER = `\n$fn=96;\n\n// One cooling fin: a 2 mm disc whose outer edge carries the 1 mm round, so the\n// fin outside diameter is 2*(30+1) = 62 mm. The round's own section is coarse\n// ($fn=24): at 96 it puts ~18k triangles on each of the 12 fins and takes the\n// CGAL union past two minutes for a 1 mm cosmetic edge.\nmodule fin(z) {\n translate([0, 0, z]) union() {\n cylinder(h = 2, r = 30);\n translate([0, 0, 1]) rotate_extrude() translate([30, 0]) circle(r = 1, $fn = 24);\n }\n}\n\ndifference() {\n union() {\n cylinder(h = 70, r = 18); // barrel\n for (i = [0:11]) fin(10 + 5 * i); // 12 fins, Z = 10..67\n // base flange OD 70 x 8, 1 mm rounds on its outer edges. The profile starts\n // at x=1 (not 0) so the revolve never sees a negative radius; the barrel\n // above fills that 1 mm core.\n rotate_extrude() offset(r = 1) offset(delta = -1)\n polygon([[1, 0], [35, 0], [35, 8], [1, 8]]);\n translate([0, 0, 70]) cylinder(h = 8, r = 22); // top cap\n // spark-plug boss: 12 mm dia, 24 mm long, 35 deg above horizontal, +X, rooted\n // inside the top cap so it fuses with it\n translate([10, 0, 72]) rotate([0, 55, 0]) cylinder(h = 24, d = 12);\n }\n // six 5 mm mounting holes on the 56 mm bolt circle of the base flange\n for (i = [0:5]) rotate([0, 0, i * 60]) translate([28, 0, -1]) cylinder(h = 10, d = 5);\n // 5 mm bore along the boss axis\n translate([10, 0, 72]) rotate([0, 55, 0]) cylinder(h = 25, d = 5);\n}\n`.trim()\n\n/** 08 — centrifugal impeller: backplate, hub, 12 backward-curved blades, bore. */\nconst CENTRIFUGAL_IMPELLER = `\n$fn=96;\n\n// Blade centreline: radius 18 -> 43 while sweeping 45 degrees backward. The blade\n// is the swept 3 mm disc along that path, so its thickness is 3 mm everywhere.\nfunction bp(t) = [(18 + 25*t) * cos(-45*t), (18 + 25*t) * sin(-45*t)];\n\nmodule blade() {\n for (i = [0:11]) hull() {\n translate(bp(i/12)) circle(d = 3, $fn = 32);\n translate(bp((i+1)/12)) circle(d = 3, $fn = 32);\n }\n}\n\ndifference() {\n union() {\n // backplate OD 90 x 6 with 1.5 mm rounds on both outer circular edges\n rotate_extrude() offset(r = 1.5) offset(delta = -1.5)\n polygon([[1, 0], [45, 0], [45, 6], [1, 6]]);\n translate([0, 0, 6]) cylinder(h = 22, r = 13); // hub\n // 12 blades, 16 mm tall above the backplate. The prompt's own radii leave a\n // 5 mm gap between the blade roots (r=18) and the hub (r=13), so the stated\n // blade-to-hub root fillet has nothing to fillet and is omitted.\n for (i = [0:11]) rotate([0, 0, i * 30])\n translate([0, 0, 6]) linear_extrude(16) blade();\n }\n translate([0, 0, -1]) cylinder(h = 30, d = 8); // through-bore\n}\n`.trim()\n\n/** 09 — spiral staircase: column, 20 helical treads, helical handrail, balusters. */\nconst SPIRAL_STAIRCASE = `\n$fn=96;\n\nn = 20; // treads\nz0 = 4; // first tread bottom\nrise = 6; // Z step per tread\nturn = 18; // degrees per tread\nrail_r = 66; rail_z0 = 14; rail_z1 = 130;\n\n// Handrail height at a given plan angle, measured counter-clockwise from +X.\nfunction rail_z(a) = rail_z0 + (rail_z1 - rail_z0) * a / 360;\n\n// A wedge tread: annulus sector from ri to ro over \"ang\" degrees.\nmodule tread(ri, ro, ang, h) {\n m = 24;\n linear_extrude(h) polygon(concat(\n [for (i = [0:m]) [ri * cos(ang*i/m), ri * sin(ang*i/m)]],\n [for (i = [m:-1:0]) [ro * cos(ang*i/m), ro * sin(ang*i/m)]]));\n}\n\nunion() {\n cylinder(h = 140, r = 7); // central column\n cylinder(h = 5, r = 45); // base disk, Z = 0..5 (overlaps the first tread)\n for (k = [0:n-1]) {\n rotate([0, 0, k * turn]) translate([0, 0, z0 + k * rise]) tread(10, 62, 24, 4);\n // baluster at the tread's outer end, mid-width, reaching the handrail centre\n rotate([0, 0, k * turn + 12]) translate([63, 0, z0 + k * rise])\n cylinder(h = rail_z(k * turn + 12) - (z0 + k * rise), d = 3);\n }\n // helical handrail: a 5 mm circle at radius 66 swept one counter-clockwise turn\n // (OpenSCAD's positive twist is clockwise) while rising Z=14 -> 130\n translate([0, 0, rail_z0])\n linear_extrude(height = rail_z1 - rail_z0, twist = -360, slices = 96)\n translate([rail_r, 0]) circle(d = 5, $fn = 48);\n}\n`.trim()\n\n/** 10 — planetary gear stage: 9 separate bodies (sun, 3 planets, ring, carrier, 3 pins). */\nconst PLANETARY_GEAR_STAGE = `\n$fn=96;\n\n// Straight-sided trapezoidal teeth: each tooth is a four-point polygon between the\n// root and tip circles, unioned onto (external) or subtracted from (internal) the\n// gear blank. Half-angles are given at the root and the tip.\nmodule ext_gear(n, r_root, r_tip, ha_root, ha_tip, phase) {\n union() {\n circle(r = r_root);\n for (i = [0:n-1]) rotate(phase + 360*i/n)\n polygon([[r_root*cos(-ha_root), r_root*sin(-ha_root)],\n [r_tip*cos(-ha_tip), r_tip*sin(-ha_tip)],\n [r_tip*cos(ha_tip), r_tip*sin(ha_tip)],\n [r_root*cos(ha_root), r_root*sin(ha_root)]]);\n }\n}\n\nmodule int_gear(n, r_tip, r_root, r_out, ha_tip, ha_root, phase) {\n difference() {\n circle(r = r_out);\n difference() {\n circle(r = r_root);\n for (i = [0:n-1]) rotate(phase + 360*i/n)\n polygon([[r_root*cos(-ha_root), r_root*sin(-ha_root)],\n [r_tip*cos(-ha_tip), r_tip*sin(-ha_tip)],\n [r_tip*cos(ha_tip), r_tip*sin(ha_tip)],\n [r_root*cos(ha_root), r_root*sin(ha_root)]]);\n }\n }\n}\n\ngz = 16; // gear underside; the pins (Z=0..14) stop 2 mm short of it\ngt = 8; // gear thickness\n\n// sun: 24 teeth, root d42, OD 54. Phase 7.5 puts a tooth SPACE on each of the\n// three planet directions (0/120/240 deg), which is the only phase where the sun\n// tip circle clears the planet root circle at all.\ntranslate([0, 0, gz]) linear_extrude(gt) difference() {\n ext_gear(24, 21, 27, 4, 0.2, 7.5);\n circle(d = 10);\n}\n\n// three planets: 18 teeth, root d31, OD 41, centres on r=42 every 120 deg. Phase 0\n// puts a tooth on the sun side (local 180) and on the ring side (local 0).\nfor (i = [0:2]) rotate(120*i) translate([42, 0, gz])\n linear_extrude(gt) ext_gear(18, 15.5, 20.5, 5, 2, 0);\n\n// ring: 60 internal teeth, OD 140, internal root d126.\n// DEVIATION: internal tooth-tip diameter is 116, not the prompt's 114. At 114 the\n// ring tooth tips sit at r=57 while the planet ROOT circles reach r=42+15.5=57.5,\n// so every planet overlaps every ring tooth and the required nine separate bodies\n// cannot exist at any phase or rotation. 116 restores 0.5 mm of tip clearance and\n// leaves every other stated diameter untouched.\ntranslate([0, 0, gz]) linear_extrude(gt) int_gear(60, 58, 63, 70, 1.0, 1.5, 3);\n\n// carrier plate, Z = -5..-1\ntranslate([0, 0, -5]) cylinder(h = 4, r = 52.5);\n\n// three planet pins, Z = 0..14, clear of both the carrier and the gears\nfor (i = [0:2]) rotate(120*i) translate([42, 0, 0]) cylinder(h = 14, d = 6);\n`.trim()\n\n/** Gold OpenSCAD source per task id. */\nexport const MCAD_GOLDS: Record<string, string> = {\n 'calibration-block': CALIBRATION_BLOCK,\n 'circular-flange': CIRCULAR_FLANGE,\n 'l-bracket': L_BRACKET,\n 'stepped-shaft-keyway': STEPPED_SHAFT_KEYWAY,\n 'open-top-electronics-enclosure': OPEN_TOP_ELECTRONICS_ENCLOSURE,\n 'clevis-bracket-lightening-cutouts': CLEVIS_BRACKET,\n 'radial-engine-cylinder': RADIAL_ENGINE_CYLINDER,\n 'centrifugal-impeller': CENTRIFUGAL_IMPELLER,\n 'spiral-staircase': SPIRAL_STAIRCASE,\n 'planetary-gear-stage': PLANETARY_GEAR_STAGE,\n}\n"],"mappings":";AA2VA,MAAa,aAAqC;CAChD,qBA5UwB;;;;;;;;;;;;;;;;;EAiBxB,KA2TqB;CACrB,mBAzTsB;;;;;;;;;;;;;;EActB,KA2SmB;CACnB,aAzSgB;;;;;;;;;;;;;;;;;;;;;;;EAuBhB,KAkRa;CACb,wBAhR2B;;;;;;;;;;;;;;;;;;;EAmB3B,KA6PwB;CACxB,kCA3PqC;;;;;;;;;;;;;;;;;;;;;;EAsBrC,KAqOkC;CAClC,qCAnOqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkDrB,KAiLqC;CACrC,0BA/K6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiC7B,KA8I0B;CAC1B,wBA5I2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4B3B,KAgHwB;CACxB,oBA9GuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmCvB,KA2EoB;CACpB,wBAzE2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4D3B,KAawB;AAC1B"}
1
+ {"version":3,"file":"mcad-golds.js","names":[],"sources":["../../src/benchmarks/mcad-golds.ts"],"sourcesContent":["/**\n * MCAD gold oracles — one OpenSCAD model per task in `mcad-tasks.ts`.\n *\n * These are CALIBRATION artifacts, not exemplar answers: their whole job is to\n * prove the judge's accept direction fires, so they are written plain (no clever\n * parametrics, `$fn=96` on round features) and every one of them has been run\n * through `createMcadBenchAdapter().evaluate()` on this host. A task is marked\n * `calibrated: true` in `mcad-tasks.ts` only when its gold below scores 1.0.\n *\n * Where a gold deviates from the prompt's literal dimensions, the deviation is\n * named in a comment at the point of the deviation, with the reason. There is one\n * such deviation (task 10's ring tooth-tip diameter — the prompt's own numbers\n * make a coplanar 9-body assembly geometrically impossible; see the comment).\n */\n\n/** 01 — 100 x 60 x 20 block, four 8 mm through-holes, 2 mm top-perimeter chamfer. */\nconst CALIBRATION_BLOCK = `\n$fn=96;\n\n// The chamfer is the hull between the full-size body and a 2 mm inset top plate,\n// so it lands on the top perimeter only and leaves the bore walls square.\nmodule chamfered_block(l, w, h, c) {\n hull() {\n translate([-l/2, -w/2, 0]) cube([l, w, h - c]);\n translate([-l/2 + c, -w/2 + c, h - c]) cube([l - 2*c, w - 2*c, c]);\n }\n}\n\ndifference() {\n chamfered_block(100, 60, 20, 2);\n for (x = [-35, 35]) for (y = [-20, 20])\n translate([x, y, -1]) cylinder(h = 22, d = 8);\n}\n`.trim()\n\n/** 02 — OD 80 x 10 flange, 30 mm central bore, six 6 mm holes on a 60 mm bolt circle. */\nconst CIRCULAR_FLANGE = `\n$fn=96;\n\n// Revolved section: a 15..40 mm x 0..10 mm rectangle whose corners are rounded by\n// 1.5 mm (shrink then grow). That carries the required round on both outside\n// circular edges; the same round lands on the bore edges, which the prompt does\n// not ask for and does not forbid.\ndifference() {\n rotate_extrude()\n offset(r = 1.5) offset(delta = -1.5)\n polygon([[15, 0], [40, 0], [40, 10], [15, 10]]);\n for (i = [0:5]) rotate([0, 0, i * 60])\n translate([30, 0, -1]) cylinder(h = 12, d = 6);\n}\n`.trim()\n\n/** 03 — L bracket: 80 x 50 x 8 base, 80 x 8 x 50 back plate, 4 holes, 2 gussets. */\nconst L_BRACKET = `\n$fn=96;\n\n// The L is a (Y, Z) section extruded along X. rotate([90,0,90]) maps local\n// (x, y, z) to global (z, x, y), so a 2D point (y, z) extrudes along +X.\nr = 2; // round on the outside corner where the base and the back plate meet\narc = [for (i = [0:8]) [25 - r + r*cos(-90 + 90*i/8), r + r*sin(-90 + 90*i/8)]];\nsection = concat([[-25, 0], [25 - r, 0]], arc, [[25, 58], [17, 58], [17, 8], [-25, 8]]);\n\ndifference() {\n union() {\n translate([-40, 0, 0]) rotate([90, 0, 90]) linear_extrude(80) polygon(section);\n // gussets: right triangle 30 tall x 30 deep, 8 mm thick in X, at X = +/-20\n for (x = [-20, 20])\n translate([x - 4, 0, 0]) rotate([90, 0, 90]) linear_extrude(8)\n polygon([[17, 8], [-13, 8], [17, 38]]);\n }\n // base plate through-holes; the cutter stops flush at the base top (Z=8) so it\n // cannot notch the gussets that stand on that face\n for (x = [-25, 25]) translate([x, -10, -1]) cylinder(h = 9, d = 6);\n // back plate through-holes, along +Y through the 8 mm thickness\n for (x = [-25, 25]) translate([x, 17, 30]) rotate([-90, 0, 0]) cylinder(h = 9, d = 6);\n}\n`.trim()\n\n/** 04 — stepped shaft along X with 1 mm end chamfers and a top keyway. */\nconst STEPPED_SHAFT_KEYWAY = `\n$fn=96;\n\n// Every section is a cylinder laid along +X; the two end chamfers are 1 mm frusta.\nmodule seg(x, len, r1, r2) {\n translate([x, 0, 0]) rotate([0, 90, 0]) cylinder(h = len, r1 = r1, r2 = r2);\n}\n\ndifference() {\n union() {\n seg(0, 1, 9, 10);\n seg(1, 29, 10, 10);\n seg(30, 60, 15, 15);\n seg(90, 29, 10, 10);\n seg(119, 1, 10, 9);\n }\n // keyway: 6 mm wide in Y, 3 mm deep from the Z=15 top, X = 40..80\n translate([40, -3, 12]) cube([40, 6, 5]);\n}\n`.trim()\n\n/** 05 — open-top enclosure, 3 mm walls/floor, four standoffs with blind holes. */\nconst OPEN_TOP_ELECTRONICS_ENCLOSURE = `\n$fn=96;\n\n// Outer box with 2 mm rounds on the four vertical corners.\nmodule rounded_box(l, w, h, r) {\n hull() for (x = [-l/2 + r, l/2 - r]) for (y = [-w/2 + r, w/2 - r])\n translate([x, y, 0]) cylinder(h = h, r = r);\n}\n\nunion() {\n difference() {\n rounded_box(100, 70, 30, 2);\n // interior cavity: 3 mm walls, 3 mm floor, open at the top\n translate([-47, -32, 3]) cube([94, 64, 31]);\n }\n // standoffs rising from the inside floor, each with a 3 mm x 8 mm blind hole\n for (x = [-35, 35]) for (y = [-25, 25])\n translate([x, y, 3]) difference() {\n cylinder(h = 12, d = 10);\n translate([0, 0, 4]) cylinder(h = 9, d = 3);\n }\n}\n`.trim()\n\n/** 06 — clevis bracket: base plate, two lugs with a 14 mm pin bore, ribs, cutouts. */\nconst CLEVIS_BRACKET = `\n$fn=96;\n\n// Base plate, 3 mm rounds on the four vertical perimeter corners.\nmodule base_plate() {\n hull() for (x = [-57, 57]) for (y = [-27, 27])\n translate([x, y, 0]) cylinder(h = 10, r = 3);\n}\n\n// One clevis lug: an (X, Z) side profile extruded 18 mm in Y. The straight part\n// runs Z=10..34 and the semicircular cap is r=18 about Z=34, so the lug top is at\n// Z=52 -- exactly 42 mm above the base, as the prompt states.\nmodule lug() {\n translate([0, 26, 0]) rotate([90, 0, 0]) linear_extrude(18)\n union() {\n translate([-18, 10]) square([36, 24]);\n translate([0, 34]) circle(r = 18);\n }\n}\n\n// 2 mm transition flare where the lug foot meets the base plate.\nmodule lug_foot() {\n hull() {\n translate([-20, 6, 10]) cube([40, 22, 0.01]);\n translate([-18, 8, 12]) cube([36, 18, 0.01]);\n }\n}\n\n// Diagonal reinforcing rib, 6 mm thick in Y, lying against the lug's outer face.\nmodule rib() {\n translate([0, 26, 0]) rotate([90, 0, 0]) linear_extrude(6)\n polygon([[18, 10], [40, 10], [18, 34]]);\n}\n\ndifference() {\n union() {\n base_plate();\n lug(); mirror([0, 1, 0]) lug();\n lug_foot(); mirror([0, 1, 0]) lug_foot();\n rib(); mirror([0, 1, 0]) rib();\n }\n // clevis pin bore, 14 mm through both lugs along Y at X=0, Z=34\n translate([0, -27, 34]) rotate([-90, 0, 0]) cylinder(h = 54, d = 14);\n // four 7 mm base mounting holes\n for (x = [-45, 45]) for (y = [-20, 20])\n translate([x, y, -1]) cylinder(h = 12, d = 7);\n // triangular lightening cutouts through the base web, corners rounded 3 mm\n for (x = [-31, 31]) translate([x, 0, -1]) linear_extrude(12)\n offset(r = 3) polygon([[6, 0], [-3, 5.2], [-3, -5.2]]);\n}\n`.trim()\n\n/** 07 — radial engine cylinder: barrel, 12 fins, base flange, top cap, plug boss. */\nconst RADIAL_ENGINE_CYLINDER = `\n$fn=96;\n\n// One cooling fin: a 2 mm disc whose outer edge carries the 1 mm round, so the\n// fin outside diameter is 2*(30+1) = 62 mm. The round's own section is coarse\n// ($fn=24): at 96 it puts ~18k triangles on each of the 12 fins and takes the\n// CGAL union past two minutes for a 1 mm cosmetic edge.\nmodule fin(z) {\n translate([0, 0, z]) union() {\n cylinder(h = 2, r = 30);\n translate([0, 0, 1]) rotate_extrude() translate([30, 0]) circle(r = 1, $fn = 24);\n }\n}\n\ndifference() {\n union() {\n cylinder(h = 70, r = 18); // barrel\n for (i = [0:11]) fin(10 + 5 * i); // 12 fins, Z = 10..67\n // base flange OD 70 x 8, 1 mm rounds on its outer edges. The profile starts\n // at x=1 (not 0) so the revolve never sees a negative radius; the barrel\n // above fills that 1 mm core.\n rotate_extrude() offset(r = 1) offset(delta = -1)\n polygon([[1, 0], [35, 0], [35, 8], [1, 8]]);\n translate([0, 0, 70]) cylinder(h = 8, r = 22); // top cap\n // spark-plug boss: 12 mm dia, 24 mm long, 35 deg above horizontal, +X, rooted\n // inside the top cap so it fuses with it\n translate([10, 0, 72]) rotate([0, 55, 0]) cylinder(h = 24, d = 12);\n }\n // six 5 mm mounting holes on the 56 mm bolt circle of the base flange\n for (i = [0:5]) rotate([0, 0, i * 60]) translate([28, 0, -1]) cylinder(h = 10, d = 5);\n // 5 mm bore along the boss axis\n translate([10, 0, 72]) rotate([0, 55, 0]) cylinder(h = 25, d = 5);\n}\n`.trim()\n\n/** 08 — centrifugal impeller: backplate, hub, 12 backward-curved blades, bore. */\nconst CENTRIFUGAL_IMPELLER = `\n$fn=96;\n\n// Blade centreline: radius 18 -> 43 while sweeping 45 degrees backward. The blade\n// is the swept 3 mm disc along that path, so its thickness is 3 mm everywhere.\nfunction bp(t) = [(18 + 25*t) * cos(-45*t), (18 + 25*t) * sin(-45*t)];\n\nmodule blade() {\n for (i = [0:11]) hull() {\n translate(bp(i/12)) circle(d = 3, $fn = 32);\n translate(bp((i+1)/12)) circle(d = 3, $fn = 32);\n }\n}\n\ndifference() {\n union() {\n // backplate OD 90 x 6 with 1.5 mm rounds on both outer circular edges\n rotate_extrude() offset(r = 1.5) offset(delta = -1.5)\n polygon([[1, 0], [45, 0], [45, 6], [1, 6]]);\n translate([0, 0, 6]) cylinder(h = 22, r = 13); // hub\n // 12 blades, 16 mm tall above the backplate. The prompt's own radii leave a\n // 5 mm gap between the blade roots (r=18) and the hub (r=13), so the stated\n // blade-to-hub root fillet has nothing to fillet and is omitted.\n for (i = [0:11]) rotate([0, 0, i * 30])\n translate([0, 0, 6]) linear_extrude(16) blade();\n }\n translate([0, 0, -1]) cylinder(h = 30, d = 8); // through-bore\n}\n`.trim()\n\n/** 09 — spiral staircase: column, 20 helical treads, helical handrail, balusters. */\nconst SPIRAL_STAIRCASE = `\n$fn=96;\n\nn = 20; // treads\nz0 = 4; // first tread bottom\nrise = 6; // Z step per tread\nturn = 18; // degrees per tread\nrail_r = 66; rail_z0 = 14; rail_z1 = 130;\n\n// Handrail height at a given plan angle, measured counter-clockwise from +X.\nfunction rail_z(a) = rail_z0 + (rail_z1 - rail_z0) * a / 360;\n\n// A wedge tread: annulus sector from ri to ro over \"ang\" degrees.\nmodule tread(ri, ro, ang, h) {\n m = 24;\n linear_extrude(h) polygon(concat(\n [for (i = [0:m]) [ri * cos(ang*i/m), ri * sin(ang*i/m)]],\n [for (i = [m:-1:0]) [ro * cos(ang*i/m), ro * sin(ang*i/m)]]));\n}\n\nunion() {\n cylinder(h = 140, r = 7); // central column\n cylinder(h = 5, r = 45); // base disk, Z = 0..5 (overlaps the first tread)\n for (k = [0:n-1]) {\n rotate([0, 0, k * turn]) translate([0, 0, z0 + k * rise]) tread(10, 62, 24, 4);\n // baluster at the tread's outer end, mid-width, reaching the handrail centre\n rotate([0, 0, k * turn + 12]) translate([63, 0, z0 + k * rise])\n cylinder(h = rail_z(k * turn + 12) - (z0 + k * rise), d = 3);\n }\n // helical handrail: a 5 mm circle at radius 66 swept one counter-clockwise turn\n // (OpenSCAD's positive twist is clockwise) while rising Z=14 -> 130\n translate([0, 0, rail_z0])\n linear_extrude(height = rail_z1 - rail_z0, twist = -360, slices = 96)\n translate([rail_r, 0]) circle(d = 5, $fn = 48);\n}\n`.trim()\n\n/** 10 — planetary gear stage: 9 separate bodies (sun, 3 planets, ring, carrier, 3 pins). */\nconst PLANETARY_GEAR_STAGE = `\n$fn=96;\n\n// Straight-sided trapezoidal teeth: each tooth is a four-point polygon between the\n// root and tip circles, unioned onto (external) or subtracted from (internal) the\n// gear blank. Half-angles are given at the root and the tip.\nmodule ext_gear(n, r_root, r_tip, ha_root, ha_tip, phase) {\n union() {\n circle(r = r_root);\n for (i = [0:n-1]) rotate(phase + 360*i/n)\n polygon([[r_root*cos(-ha_root), r_root*sin(-ha_root)],\n [r_tip*cos(-ha_tip), r_tip*sin(-ha_tip)],\n [r_tip*cos(ha_tip), r_tip*sin(ha_tip)],\n [r_root*cos(ha_root), r_root*sin(ha_root)]]);\n }\n}\n\nmodule int_gear(n, r_tip, r_root, r_out, ha_tip, ha_root, phase) {\n difference() {\n circle(r = r_out);\n difference() {\n circle(r = r_root);\n for (i = [0:n-1]) rotate(phase + 360*i/n)\n polygon([[r_root*cos(-ha_root), r_root*sin(-ha_root)],\n [r_tip*cos(-ha_tip), r_tip*sin(-ha_tip)],\n [r_tip*cos(ha_tip), r_tip*sin(ha_tip)],\n [r_root*cos(ha_root), r_root*sin(ha_root)]]);\n }\n }\n}\n\ngz = 16; // gear underside; the pins (Z=0..14) stop 2 mm short of it\ngt = 8; // gear thickness\n\n// sun: 24 teeth, root d42, OD 54. Phase 7.5 puts a tooth SPACE on each of the\n// three planet directions (0/120/240 deg), which is the only phase where the sun\n// tip circle clears the planet root circle at all.\ntranslate([0, 0, gz]) linear_extrude(gt) difference() {\n ext_gear(24, 21, 27, 4, 0.2, 7.5);\n circle(d = 10);\n}\n\n// three planets: 18 teeth, root d31, OD 41, centres on r=42 every 120 deg. Phase 0\n// puts a tooth on the sun side (local 180) and on the ring side (local 0).\nfor (i = [0:2]) rotate(120*i) translate([42, 0, gz])\n linear_extrude(gt) ext_gear(18, 15.5, 20.5, 5, 2, 0);\n\n// ring: 60 internal teeth, OD 140, internal root d126.\n// DEVIATION: internal tooth-tip diameter is 116, not the prompt's 114. At 114 the\n// ring tooth tips sit at r=57 while the planet ROOT circles reach r=42+15.5=57.5,\n// so every planet overlaps every ring tooth and the required nine separate bodies\n// cannot exist at any phase or rotation. 116 restores 0.5 mm of tip clearance and\n// leaves every other stated diameter untouched.\ntranslate([0, 0, gz]) linear_extrude(gt) int_gear(60, 58, 63, 70, 1.0, 1.5, 3);\n\n// carrier plate, Z = -5..-1\ntranslate([0, 0, -5]) cylinder(h = 4, r = 52.5);\n\n// three planet pins, Z = 0..14, clear of both the carrier and the gears\nfor (i = [0:2]) rotate(120*i) translate([42, 0, 0]) cylinder(h = 14, d = 6);\n`.trim()\n\n/** Gold OpenSCAD source per task id. */\nexport const MCAD_GOLDS: Record<string, string> = {\n 'calibration-block': CALIBRATION_BLOCK,\n 'circular-flange': CIRCULAR_FLANGE,\n 'l-bracket': L_BRACKET,\n 'stepped-shaft-keyway': STEPPED_SHAFT_KEYWAY,\n 'open-top-electronics-enclosure': OPEN_TOP_ELECTRONICS_ENCLOSURE,\n 'clevis-bracket-lightening-cutouts': CLEVIS_BRACKET,\n 'radial-engine-cylinder': RADIAL_ENGINE_CYLINDER,\n 'centrifugal-impeller': CENTRIFUGAL_IMPELLER,\n 'spiral-staircase': SPIRAL_STAIRCASE,\n 'planetary-gear-stage': PLANETARY_GEAR_STAGE,\n}\n"],"mappings":";AA2VA,MAAa,aAAqC;CAChD,qBA5UwB;;;;;;;;;;;;;;;;;EAiBxB,KA2TqB;CACrB,mBAzTsB;;;;;;;;;;;;;;EActB,KA2SmB;CACnB,aAzSgB;;;;;;;;;;;;;;;;;;;;;;;EAuBhB,KAkRa;CACb,wBAhR2B;;;;;;;;;;;;;;;;;;;EAmB3B,KA6PwB;CACxB,kCA3PqC;;;;;;;;;;;;;;;;;;;;;;EAsBrC,KAqOkC;CAClC,qCAnOqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkDrB,KAiLqC;CACrC,0BA/K6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiC7B,KA8I0B;CAC1B,wBA5I2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4B3B,KAgHwB;CACxB,oBA9GuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmCvB,KA2EoB;CACpB,wBAzE2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4D3B,KAawB;AAC1B"}
@@ -1,12 +1,12 @@
1
- import { BenchmarkAdapter } from "./types.js";
1
+ import { RuntimeBenchmark } from "./types.js";
2
2
  interface ParsedAction {
3
3
  elementId: string;
4
4
  op: string;
5
5
  value: string;
6
6
  }
7
7
  /** Parse the worker artifact's ELEMENT / ACTION / VALUE sentinel lines.
8
- * Fail-closed: a missing ELEMENT or ACTION returns null (judge → resolved=false). */
8
+ * Fail-closed: a missing ELEMENT or ACTION returns null (judge → passed=false). */
9
9
  export declare function parseAction(artifact: string): ParsedAction | null;
10
- export declare function createMind2WebAdapter(): BenchmarkAdapter;
10
+ export declare function createMind2WebAdapter(): RuntimeBenchmark;
11
11
  export {};
12
12
  //# sourceMappingURL=mind2web.d.ts.map