@fleox/agent3d 0.2.1 → 0.2.3

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 (47) hide show
  1. package/README.md +11 -10
  2. package/changelog.json +22 -0
  3. package/dist/agent/agent3d.mjs +58 -47
  4. package/dist/agent/chunks/{browser-t_JL_B82.mjs → browser-Br1tURgt.mjs} +21 -2
  5. package/dist/agent/chunks/{check-CBO3Ekx1.mjs → check-CfZcfaPs.mjs} +12 -0
  6. package/dist/agent/chunks/{export-BCI8vKw8.mjs → export-BHugc2H7.mjs} +1 -1
  7. package/dist/agent/chunks/{imageCodec-Dz9PFxi9.mjs → imageCodec-QM0EXQDJ.mjs} +1 -1
  8. package/dist/agent/chunks/{package-BOIyp_2B.mjs → package-fw4h5vsh.mjs} +2 -2
  9. package/dist/agent/chunks/{render-CN4mgGLQ.mjs → render-EHb40avl.mjs} +1 -1
  10. package/dist/agent/chunks/{tools-DT2tetIK.mjs → tools-DKxgjQSJ.mjs} +2 -2
  11. package/dist/runtime/agent3d-runtime.js +2 -2
  12. package/dist/runtime/agent3d-runtime.single.js +2 -2
  13. package/dist/runtime/chunks/catalog--OTp4gjy.js +1 -0
  14. package/dist/runtime/chunks/{generators-D5JUo0jp.js → generators--kOFg1G_.js} +1 -1
  15. package/dist/runtime/chunks/{materials-Dn-bYrZd.js → materials-w3EW0g-7.js} +1 -1
  16. package/dist/runtime/chunks/{model-BCVF3QzB.js → model-DbfZaLni.js} +1 -1
  17. package/dist/runtime/chunks/{params-C2uoUDJ0.js → params-BCNrVCYZ.js} +1 -1
  18. package/dist/runtime/chunks/{postfx-i_J5Vf-l.js → postfx-CFucYRev.js} +1 -1
  19. package/dist/runtime/chunks/{postfx-UgKCbmZs.js → postfx-Cbf_vvOr.js} +1 -1
  20. package/dist/runtime/chunks/{shaders-Dw6zHdu_.js → shaders-Ba3v6Xnj.js} +1 -1
  21. package/dist/runtime/chunks/{svg-CmlFY_8O.js → svg-CfPIQnDG.js} +1 -1
  22. package/dist/runtime/chunks/{text-D1EQpdSU.js → text-BaON-ISS.js} +1 -1
  23. package/dist/studio/assets/{camera-7sEn13L-.js → camera-Be6lnp3k.js} +1 -1
  24. package/dist/studio/assets/{editor-CnbvVkhU.js → editor-Mpnz-b2E.js} +1 -1
  25. package/dist/studio/assets/{game-B04KGAK0.js → game-WMgRSJUD.js} +3 -3
  26. package/dist/studio/assets/{generators-LSni1Yfc.js → generators-DozXE7ta.js} +1 -1
  27. package/dist/studio/assets/{index-3LL5NEIH.js → index-tSGZFEt5.js} +5 -5
  28. package/dist/studio/assets/{model-CNddhwmA.js → model-C2bZTK7-.js} +1 -1
  29. package/dist/studio/assets/{physicsHost-hMU_SDiX.js → physicsHost-CTRsIvfu.js} +1 -1
  30. package/dist/studio/assets/{postfx-BcCZS0Bq.js → postfx-DQtp0JIy.js} +1 -1
  31. package/dist/studio/assets/{runtime-DY_KqD1x.js → runtime-NGp1VdnH.js} +4 -4
  32. package/dist/studio/assets/{shaders-BhMCstyv.js → shaders-BOb6Uter.js} +1 -1
  33. package/dist/studio/assets/{svg-CNKK-h7H.js → svg-CnUMpv_N.js} +1 -1
  34. package/dist/studio/assets/{text-BSPI7dk1.js → text-CGIZs8HE.js} +1 -1
  35. package/dist/studio/index.html +1 -1
  36. package/package.json +2 -2
  37. package/plugin/.claude-plugin/plugin.json +1 -1
  38. package/plugin/skills/agent3d-assets/SKILL.md +24 -24
  39. package/plugin/skills/agent3d-create/SKILL.md +20 -20
  40. package/plugin/skills/agent3d-create/references/art-direction.md +3 -3
  41. package/plugin/skills/agent3d-create/references/recipes.md +6 -6
  42. package/plugin/skills/agent3d-edit/SKILL.md +22 -22
  43. package/plugin/skills/agent3d-edit/references/patch-ops.md +2 -2
  44. package/plugin/skills/agent3d-game/SKILL.md +7 -7
  45. package/plugin/skills/agent3d-publish/SKILL.md +21 -21
  46. package/plugin/skills/agent3d-publish/references/integrations.md +1 -1
  47. package/dist/runtime/chunks/catalog-DL6sgPay.js +0 -1
package/README.md CHANGED
@@ -16,6 +16,7 @@
16
16
  <a href="https://www.npmjs.com/package/@fleox/agent3d"><img src="https://img.shields.io/node/v/@fleox/agent3d?color=339933" alt="Node.js version"></a>
17
17
  <a href="#claude-code"><img src="https://img.shields.io/badge/Claude%20Code-plugin-d97757" alt="Claude Code plugin"></a>
18
18
  <a href="#mcp-server"><img src="https://img.shields.io/badge/MCP-server-0ea5e9" alt="MCP server"></a>
19
+ <a href="https://m8ven.ai/mcp/fleox/agent3d?s=readme"><img src="https://m8ven.ai/badge/mcp/fleox/agent3d" alt="M8ven Score"></a>
19
20
  <a href="https://github.com/fleox/agent3d/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-PolyForm%20Noncommercial-6b7280" alt="License"></a>
20
21
  </p>
21
22
 
@@ -108,19 +109,19 @@ Once the scene exists, changing it is a conversation:
108
109
  ### Without an agent
109
110
 
110
111
  ```bash
111
- npx -y @fleox/agent3d@0.2.1 new bakery --target banner --title "Golden Crust"
112
- npx -y @fleox/agent3d@0.2.1 studio --project bakery
112
+ npx -y @fleox/agent3d@0.2.3 new bakery --target banner --title "Golden Crust"
113
+ npx -y @fleox/agent3d@0.2.3 studio --project bakery
113
114
  ```
114
115
 
115
- The first command creates a project folder with an attractive starter scene for its target (banner, hero, card, square, fullscreen, inline or game); add `--template <id>` to start from one of the [templates](#templates). The second opens the [Studio](#the-studio) on it. You need **Node.js 22+** and **Google Chrome** (or Chromium / Edge / Brave) for renders; `npx -y @fleox/agent3d@0.2.1 doctor` checks your setup with a test render.
116
+ The first command creates a project folder with an attractive starter scene for its target (banner, hero, card, square, fullscreen, inline or game); add `--template <id>` to start from one of the [templates](#templates). The second opens the [Studio](#the-studio) on it. You need **Node.js 22+** and **Google Chrome** (or Chromium / Edge / Brave) for renders; `npx -y @fleox/agent3d@0.2.3 doctor` checks your setup with a test render.
116
117
 
117
118
  The whole loop from a terminal:
118
119
 
119
120
  ```bash
120
- npx -y @fleox/agent3d@0.2.1 scene patch --project bakery '[{"op":"set","path":"objects#title.material","value":{"preset":"gold"}}]'
121
- npx -y @fleox/agent3d@0.2.1 render --project bakery --sheet # → renders/…-sheet.png
122
- npx -y @fleox/agent3d@0.2.1 check --project bakery
123
- npx -y @fleox/agent3d@0.2.1 export --project bakery # → dist/embed/ + the snippet
121
+ npx -y @fleox/agent3d@0.2.3 scene patch --project bakery '[{"op":"set","path":"objects#title.material","value":{"preset":"gold"}}]'
122
+ npx -y @fleox/agent3d@0.2.3 render --project bakery --sheet # → renders/…-sheet.png
123
+ npx -y @fleox/agent3d@0.2.3 check --project bakery
124
+ npx -y @fleox/agent3d@0.2.3 export --project bakery # → dist/embed/ + the snippet
124
125
  ```
125
126
 
126
127
  Step by step: [docs/getting-started.md](https://github.com/fleox/agent3d/blob/main/docs/getting-started.md).
@@ -187,7 +188,7 @@ Step by step: [docs/getting-started.md](https://github.com/fleox/agent3d/blob/ma
187
188
  A visual editor for when you want to see and touch the scene yourself, on the same files and the same validated tools as the agent. Changes your agent makes in a terminal appear live in the open Studio.
188
189
 
189
190
  ```bash
190
- npx -y @fleox/agent3d@0.2.1 studio --project bakery
191
+ npx -y @fleox/agent3d@0.2.3 studio --project bakery
191
192
  ```
192
193
 
193
194
  <p align="center">
@@ -315,7 +316,7 @@ Pick Spline when a designer wants a hosted visual tool, hand-written Three.js wh
315
316
 
316
317
  ## The `agent3d` CLI
317
318
 
318
- The same engine the agents use, by hand: `npx -y @fleox/agent3d@0.2.1 help`. Every command accepts `--json` and prints exactly one `{ ok, data }` or `{ ok: false, error }` object with an actionable hint, and commands that replace or overwrite something print a plan until you add `--yes`.
319
+ The same engine the agents use, by hand: `npx -y @fleox/agent3d@0.2.3 help`. Every command accepts `--json` and prints exactly one `{ ok, data }` or `{ ok: false, error }` object with an actionable hint, and commands that replace or overwrite something print a plan until you add `--yes`.
319
320
 
320
321
  <p align="center">
321
322
  <img src="https://raw.githubusercontent.com/fleox/agent3d/main/.github/assets/demo-cli.gif" width="820" alt="Terminal running the agent3d CLI: a project from the gradient-blob template, its scene summary, a gold torus added, a behaviour patch rejected with an actionable error then fixed, and the pre-export check">
@@ -353,7 +354,7 @@ Full reference: [docs/cli.md](https://github.com/fleox/agent3d/blob/main/docs/cl
353
354
  ## MCP server
354
355
 
355
356
  ```bash
356
- claude mcp add agent3d -- npx -y @fleox/agent3d@0.2.1 mcp --project ~/agent3d/my-banner
357
+ claude mcp add agent3d -- npx -y @fleox/agent3d@0.2.3 mcp --project ~/agent3d/my-banner
357
358
  ```
358
359
 
359
360
  <p align="center">
package/changelog.json CHANGED
@@ -1,5 +1,27 @@
1
1
  {
2
2
  "versions": [
3
+ {
4
+ "version": "0.2.3",
5
+ "date": "2026-11-26",
6
+ "breaking": false,
7
+ "changes": [
8
+ "README / npm page: M8ven Score badge."
9
+ ],
10
+ "actions": []
11
+ },
12
+ {
13
+ "version": "0.2.2",
14
+ "date": "2026-11-23",
15
+ "breaking": false,
16
+ "changes": [
17
+ "Node.js 22 or newer is now required (`engines`); `doctor` fails its Node check below 22. Headless renders already needed it.",
18
+ "`check` triangle estimates for generators recalibrated from measurements (city, road, grass, clouds, character, bars3d, waveGrid…): cost formulas now weigh styles and options (character style and low-poly shading, tree style, bar shape, wave-grid shape, smooth terrain and islands, globe without continents), and a test keeps every generator within ×0.6–×1.6 of what it builds.",
19
+ "`check --render` reuses one temporary folder per project, emptied on each run, instead of a new one each time; headless Chrome profiles are removed even when the process exits abruptly, and stale ones are swept."
20
+ ],
21
+ "actions": [
22
+ "Use Node.js 22 or newer (`node --version`)."
23
+ ]
24
+ },
3
25
  {
4
26
  "version": "0.2.1",
5
27
  "date": "2026-11-22",
@@ -6,12 +6,13 @@ __a3dRequire(import.meta.url);
6
6
  const __filename = __a3dPath(import.meta.url);
7
7
  __a3dDirname(__filename);
8
8
  import { t as __exportAll } from "./chunks/rolldown-runtime-ebOQtxsr.mjs";
9
- import { r as version, t as package_default } from "./chunks/package-BOIyp_2B.mjs";
9
+ import { r as version, t as package_default } from "./chunks/package-fw4h5vsh.mjs";
10
10
  import { n as didYouMean, r as listOptions, t as closest } from "./chunks/suggest-Cpcgv1RP.mjs";
11
11
  import { format, parseArgs } from "node:util";
12
12
  import { createReadStream, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, watch, writeFileSync } from "node:fs";
13
13
  import { inflateRawSync } from "node:zlib";
14
14
  import { mkdir, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
15
+ import { createHash } from "node:crypto";
15
16
  import { tmpdir } from "node:os";
16
17
  import { spawn } from "node:child_process";
17
18
  import { createServer } from "node:http";
@@ -1725,7 +1726,7 @@ var GENERATORS = [
1725
1726
  n("snowLine", "Height fraction (0..1, above the water) where the last palette colour (snow) caps the peaks; 1 = summit only. Relative to this terrain's own relief: use snowHeight for the same snow altitude across terrains.", 1, 0, 1),
1726
1727
  n("snowHeight", "Absolute snow altitude in terrain units (like waterLevel): everything above is snow-capped. Overrides snowLine.", void 0, 0)
1727
1728
  ],
1728
- cost: "resolution^2*2",
1729
+ cost: "resolution^2*2+(1-lowpoly)*max(resolution, 48)^2*2+~3200*lowpoly",
1729
1730
  material: "The ground (not the water plane). Without colour / preset / map the palette bands are kept (e.g. { \"roughness\": 0.6, \"flatShading\": false })."
1730
1731
  },
1731
1732
  {
@@ -1757,7 +1758,7 @@ var GENERATORS = [
1757
1758
  b("onTerrain", "Drop onto a sibling terrain generator.", true),
1758
1759
  b("sway", "Wind sway animation.", true)
1759
1760
  ],
1760
- cost: "count*~150"
1761
+ cost: "count*(70*style_pine+200*style_round+460*style_palm+430*style_birch+220*style_dead+212*style_mixed)"
1761
1762
  },
1762
1763
  {
1763
1764
  id: "rocks",
@@ -1778,7 +1779,7 @@ var GENERATORS = [
1778
1779
  ]),
1779
1780
  b("onTerrain", "Drop onto a sibling terrain.", true)
1780
1781
  ],
1781
- cost: "count*80",
1782
+ cost: "count*40",
1782
1783
  material: "Every rock. Without colour / preset / map the per-rock colours are kept."
1783
1784
  },
1784
1785
  {
@@ -1796,7 +1797,7 @@ var GENERATORS = [
1796
1797
  n("wind", "Wind strength.", .5, 0),
1797
1798
  b("onTerrain", "Follow a sibling terrain.", true)
1798
1799
  ],
1799
- cost: "count*1"
1800
+ cost: "count*3"
1800
1801
  },
1801
1802
  {
1802
1803
  id: "flowers",
@@ -1816,7 +1817,7 @@ var GENERATORS = [
1816
1817
  ]),
1817
1818
  b("onTerrain", "Follow a sibling terrain.", true)
1818
1819
  ],
1819
- cost: "count*40"
1820
+ cost: "count*56"
1820
1821
  },
1821
1822
  {
1822
1823
  id: "water",
@@ -1836,7 +1837,7 @@ var GENERATORS = [
1836
1837
  b("reflections", "Planar mirror reflections of the scene (mirror lakes at sunrise; lower waveHeight / ripples for a calm mirror). Costly: the scene is rendered a second time each frame (half resolution on the medium tier, off on the low tier).", false),
1837
1838
  n("reflectivity", "Reflection strength with reflections on (fresnel: stronger at grazing angles).", .8, 0, 1)
1838
1839
  ],
1839
- cost: "~20000"
1840
+ cost: "min(size*(3-1.6*lowpoly), 160)^2*2"
1840
1841
  },
1841
1842
  {
1842
1843
  id: "clouds",
@@ -1855,7 +1856,7 @@ var GENERATORS = [
1855
1856
  n("speed", "Drift speed.", .3, 0),
1856
1857
  e("style", "puffy = smooth soft puffs, lowpoly = faceted.", ["puffy", "lowpoly"], "puffy")
1857
1858
  ],
1858
- cost: "count*1500"
1859
+ cost: "count*(2600-1950*style_lowpoly)"
1859
1860
  },
1860
1861
  {
1861
1862
  id: "city",
@@ -1876,7 +1877,7 @@ var GENERATORS = [
1876
1877
  c("windowColor", "Window colour.", "#ffe8a3"),
1877
1878
  b("trees", "Street trees.", true)
1878
1879
  ],
1879
- cost: "blocks^2*4*12"
1880
+ cost: "blocks^2*(235+205*trees)"
1880
1881
  },
1881
1882
  {
1882
1883
  id: "character",
@@ -1964,7 +1965,7 @@ var GENERATORS = [
1964
1965
  ], "smooth"),
1965
1966
  b("eyesFollowPointer", "Head turns toward the pointer.", false)
1966
1967
  ],
1967
- cost: "~14000"
1968
+ cost: "(16100*style_humanoid+17300*style_astronaut+11600*style_robot+7700*style_blob+9500*style_cat+9800*style_fox+9100*style_bird+6400*style_ghost)*(1-0.82*shading_lowpoly)"
1968
1969
  },
1969
1970
  {
1970
1971
  id: "planet",
@@ -1985,7 +1986,7 @@ var GENERATORS = [
1985
1986
  i("detail", "Subdivision.", 5, 1, 7),
1986
1987
  n("spin", "Globe rotation around its own (ring) axis in deg/s — use this rather than a rotate behaviour so the rings stay stable.", 0)
1987
1988
  ],
1988
- cost: "20*4^detail",
1989
+ cost: "20*4^detail+~700",
1989
1990
  material: "The globe surface (ocean + land; rings and atmosphere keep theirs). Without colour / preset / map the palette is kept."
1990
1991
  },
1991
1992
  {
@@ -2039,7 +2040,7 @@ var GENERATORS = [
2039
2040
  cs("colors", "Colour ramp.", ["#3a86ff", "#ff006e"]),
2040
2041
  b("pointerRipple", "Ripple under the pointer.", true)
2041
2042
  ],
2042
- cost: "columns*rows*2"
2043
+ cost: "columns*rows*(1+shape_lines+11*shape_bars)"
2043
2044
  },
2044
2045
  {
2045
2046
  id: "maze",
@@ -2053,7 +2054,7 @@ var GENERATORS = [
2053
2054
  c("floorColor", "Floor.", "#e0b1cb"),
2054
2055
  b("bodies", "Add static physics bodies to walls.", true)
2055
2056
  ],
2056
- cost: "columns*rows*24"
2057
+ cost: "columns*rows*7"
2057
2058
  },
2058
2059
  {
2059
2060
  id: "road",
@@ -2069,7 +2070,7 @@ var GENERATORS = [
2069
2070
  b("verge", "Striped verges on both sides (false = road and curbs only, e.g. over a dark ground or a grid).", true),
2070
2071
  cs("vergeColor", "Verge colours: two alternating stripes; one = that colour plus a slightly darker stripe.", ["#7cc45a", "#6bb44c"])
2071
2072
  ],
2072
- cost: "~200"
2073
+ cost: "length*14+~220"
2073
2074
  },
2074
2075
  {
2075
2076
  id: "birds",
@@ -2113,7 +2114,7 @@ var GENERATORS = [
2113
2114
  speed: 5,
2114
2115
  size: 1.2
2115
2116
  },
2116
- cost: "count*18"
2117
+ cost: "count*15"
2117
2118
  },
2118
2119
  {
2119
2120
  id: "floatingIsland",
@@ -2157,7 +2158,7 @@ var GENERATORS = [
2157
2158
  n("float", "Bob amplitude (0 = still).", .12, 0),
2158
2159
  b("lowpoly", "Faceted shading.", true)
2159
2160
  ],
2160
- cost: "~6000+trees*150+grass+flowers*40",
2161
+ cost: "~2500+7300*(1-lowpoly)+trees*220+grass*3+flowers*56",
2161
2162
  material: "The island body (top + underside). Without colour / preset / map the vertex colours are kept."
2162
2163
  },
2163
2164
  {
@@ -2194,7 +2195,7 @@ var GENERATORS = [
2194
2195
  n("longitude", "Longitude facing the camera at t = 0 (degrees).", 0),
2195
2196
  n("tilt", "Axis tilt (degrees).", 12)
2196
2197
  ],
2197
- cost: "dots*0.35*6+~8000",
2198
+ cost: "dots*(1.9+4.1*(1-continents))+~18000",
2198
2199
  material: "The globe body sphere (dots, arcs and atmosphere keep theirs)."
2199
2200
  },
2200
2201
  {
@@ -2220,7 +2221,7 @@ var GENERATORS = [
2220
2221
  b("base", "Rock base under a cluster.", true),
2221
2222
  c("baseColor", "Base rock colour.", "#4b4560")
2222
2223
  ],
2223
- cost: "count*40+~600",
2224
+ cost: "count*16.5+~560*base*layout_cluster",
2224
2225
  material: "The crystals (not the base). Without colour / preset / map the gradients are kept."
2225
2226
  },
2226
2227
  {
@@ -2286,7 +2287,7 @@ var GENERATORS = [
2286
2287
  b("base", "Base plate.", true),
2287
2288
  c("baseColor", "Base plate colour.", "#eef2ff")
2288
2289
  ],
2289
- cost: "dataCells*1000+~600",
2290
+ cost: "dataCells*(970*shape_rounded+12*shape_box+128*shape_cylinder)+~590",
2290
2291
  material: "Every bar (per-bar colours are kept as instance colours)."
2291
2292
  },
2292
2293
  {
@@ -2333,7 +2334,7 @@ var GENERATORS = [
2333
2334
  ], "matte"),
2334
2335
  n("motion", "Float / spin amount (0 = still).", 1, 0)
2335
2336
  ],
2336
- cost: "count*1500",
2337
+ cost: "count*1250",
2337
2338
  material: "Every shape (per-shape palette colours are kept as instance colours)."
2338
2339
  }
2339
2340
  ];
@@ -8355,8 +8356,8 @@ var assetsCommand = {
8355
8356
  inflate: (d) => new Uint8Array(inflateRawSync(d))
8356
8357
  });
8357
8358
  let entry;
8358
- if (maxSize && (await import("./chunks/browser-t_JL_B82.mjs")).findBrowser()) {
8359
- const { withImageCodec } = await import("./chunks/imageCodec-Dz9PFxi9.mjs");
8359
+ if (maxSize && (await import("./chunks/browser-Br1tURgt.mjs")).findBrowser()) {
8360
+ const { withImageCodec } = await import("./chunks/imageCodec-QM0EXQDJ.mjs");
8360
8361
  entry = await withImageCodec((codec) => dl(codec), { log: log$1 });
8361
8362
  } else entry = await dl();
8362
8363
  return printResult(io, { asset: entry }, () => [
@@ -8459,7 +8460,7 @@ var assetsCommand = {
8459
8460
  hint: "--dry-run reports the real savings without writing; --max-size forces one size."
8460
8461
  }, humanPlan)) return;
8461
8462
  const needsCodec = plan.entries.some((e) => e.kind === "texture" || (e.images ?? 0) > 0);
8462
- const { findBrowser } = await import("./chunks/browser-t_JL_B82.mjs");
8463
+ const { findBrowser } = await import("./chunks/browser-Br1tURgt.mjs");
8463
8464
  const run = (codec) => optimizeAssets(fs, {
8464
8465
  ...opts,
8465
8466
  paths: plan.entries.map((e) => e.path),
@@ -8468,7 +8469,7 @@ var assetsCommand = {
8468
8469
  }, codec);
8469
8470
  let r;
8470
8471
  if (needsCodec && findBrowser()) {
8471
- const { withImageCodec } = await import("./chunks/imageCodec-Dz9PFxi9.mjs");
8472
+ const { withImageCodec } = await import("./chunks/imageCodec-QM0EXQDJ.mjs");
8472
8473
  r = await withImageCodec((codec) => run(codec), { log: log$1 });
8473
8474
  } else r = await run();
8474
8475
  r.skipped.unshift(...plan.skipped);
@@ -8618,7 +8619,7 @@ var checkCommand = {
8618
8619
  {
8619
8620
  name: "render",
8620
8621
  type: "boolean",
8621
- description: "Also render one frame headless (Chrome) for real triangle counts and framing (objects out of view, camera inside an object). The frame goes to a temporary folder (its absolute path is in `render`) unless --out is given."
8622
+ description: "Also render one frame headless (Chrome) for real triangle counts and framing (objects out of view, camera inside an object). The frame goes to a temporary folder, one per project and emptied on each run (its absolute path is in `render`), unless --out is given."
8622
8623
  },
8623
8624
  {
8624
8625
  name: "out",
@@ -8628,16 +8629,16 @@ var checkCommand = {
8628
8629
  ],
8629
8630
  async run({ io, options }) {
8630
8631
  const fs = projectFs(options);
8631
- const { checkProject } = await import("./chunks/check-CBO3Ekx1.mjs").then((n) => n.r);
8632
+ const { checkProject } = await import("./chunks/check-CfZcfaPs.mjs").then((n) => n.r);
8632
8633
  let extra = {
8633
8634
  library: readLibraryIndex(),
8634
8635
  ...runtimeKb() !== void 0 ? { runtimeKb: runtimeKb() } : {}
8635
8636
  };
8636
8637
  let renderNote;
8637
8638
  if (boolOpt(options, "render")) {
8638
- const { renderProject } = await import("./chunks/render-CN4mgGLQ.mjs");
8639
+ const { renderProject } = await import("./chunks/render-EHb40avl.mjs");
8639
8640
  const out = strOpt(options, "out");
8640
- const outDir = out ? isAbsolute(out) ? out : resolve(fs.root, out) : mkdtempSync(join(tmpdir(), "agent3d-check-"));
8641
+ const outDir = out ? isAbsolute(out) ? out : resolve(fs.root, out) : checkRenderDir(fs.root);
8641
8642
  const r = await renderProject({
8642
8643
  projectDir: fs.root,
8643
8644
  count: 1,
@@ -8669,6 +8670,16 @@ function runtimeKb() {
8669
8670
  const bytes = Object.values(readRuntimeFiles("embed")).reduce((a, f) => a + f.byteLength, 0);
8670
8671
  return Math.round(bytes / 1024 * 10) / 10;
8671
8672
  }
8673
+ function checkRenderDir(projectRoot) {
8674
+ const id = createHash("sha1").update(resolve(projectRoot)).digest("hex").slice(0, 10);
8675
+ const dir = join(tmpdir(), "agent3d-check", `${basename(projectRoot).replace(/[^\w.-]/g, "_") || "project"}-${id}`);
8676
+ rmSync(dir, {
8677
+ recursive: true,
8678
+ force: true
8679
+ });
8680
+ mkdirSync(dir, { recursive: true });
8681
+ return dir;
8682
+ }
8672
8683
  // agent/commands/meta.ts
8673
8684
  var versionCommand = {
8674
8685
  name: "version",
@@ -8766,11 +8777,11 @@ var doctorCommand = {
8766
8777
  const major = Number(process.versions.node.split(".")[0]);
8767
8778
  checks.push({
8768
8779
  id: "node",
8769
- ok: major >= 20,
8770
- message: `Node ${process.versions.node}${major >= 22 ? "" : major >= 20 ? " (headless renders need Node 22+: global WebSocket)" : ""}`,
8780
+ ok: major >= 22,
8781
+ message: `Node ${process.versions.node}${major >= 22 ? "" : " (Agent3D needs Node 22+)"}`,
8771
8782
  ...major < 22 ? { hint: "Install Node 22 or newer (https://nodejs.org)." } : {}
8772
8783
  });
8773
- const { findBrowser, browserVersion, noBrowserError } = await import("./chunks/browser-t_JL_B82.mjs");
8784
+ const { findBrowser, browserVersion, noBrowserError } = await import("./chunks/browser-Br1tURgt.mjs");
8774
8785
  const browser = findBrowser();
8775
8786
  if (browser) {
8776
8787
  const version = await browserVersion(browser.path);
@@ -8836,7 +8847,7 @@ var doctorCommand = {
8836
8847
  const dir = mkdtempSync(join(tmpdir(), "agent3d-doctor-"));
8837
8848
  try {
8838
8849
  writeFileSync(join(dir, "scene.json"), JSON.stringify(DOCTOR_SCENE));
8839
- const { renderProject } = await import("./chunks/render-CN4mgGLQ.mjs");
8850
+ const { renderProject } = await import("./chunks/render-EHb40avl.mjs");
8840
8851
  const { decodePng, pngVariance } = await import("./chunks/png-DXfSGJZt.mjs");
8841
8852
  const t0 = Date.now();
8842
8853
  const r = await renderProject({
@@ -9157,10 +9168,10 @@ var renderCommand = {
9157
9168
  ],
9158
9169
  async run({ io, options }) {
9159
9170
  const fs = projectFs(options);
9160
- const { parseQuality } = await import("./chunks/render-CN4mgGLQ.mjs");
9171
+ const { parseQuality } = await import("./chunks/render-EHb40avl.mjs");
9161
9172
  const quality = parseQuality(strOpt(options, "quality"));
9162
9173
  const scroll = numOpt(options, "scroll");
9163
- const { parseInputScript } = await import("./chunks/render-CN4mgGLQ.mjs");
9174
+ const { parseInputScript } = await import("./chunks/render-EHb40avl.mjs");
9164
9175
  const rawInput = strOpt(options, "input") !== void 0 ? jsonOpt(options, "input", `--input '[{"t": 0.5, "key": "ArrowRight", "hold": 1}]' or --input @inputs.json`) : void 0;
9165
9176
  const input = rawInput === void 0 ? void 0 : parseInputScript(rawInput);
9166
9177
  const segment = strOpt(options, "segment");
@@ -9174,7 +9185,7 @@ var renderCommand = {
9174
9185
  if (mediaOpts.length) {
9175
9186
  const kind = mediaOpts[0];
9176
9187
  const out = projectPath(fs.root, strOpt(options, kind));
9177
- const { renderMedia, mediaFormatFromPath } = await import("./chunks/render-CN4mgGLQ.mjs");
9188
+ const { renderMedia, mediaFormatFromPath } = await import("./chunks/render-EHb40avl.mjs");
9178
9189
  const format = kind === "video" ? mediaFormatFromPath(out) : kind;
9179
9190
  if (kind === "video" && format !== "mp4" && format !== "webm") usage(`--video needs a .mp4 or .webm file name, got "${strOpt(options, kind)}".`, "e.g. --video renders/banner.mp4");
9180
9191
  if (existsSync(out) && !confirmOrPlan(io, options, { overwrite: [out] }, () => `Overwrite ${out}`)) return;
@@ -9212,7 +9223,7 @@ var renderCommand = {
9212
9223
  "canvas",
9213
9224
  "page"
9214
9225
  ].includes(capture)) usage(`--capture must be auto, canvas or page, got "${capture}".`);
9215
- const { renderProject } = await import("./chunks/render-CN4mgGLQ.mjs");
9226
+ const { renderProject } = await import("./chunks/render-EHb40avl.mjs");
9216
9227
  const frames = renderFrames(strOpt(options, "frames"), numOpt(options, "count"), scroll);
9217
9228
  const r = await renderProject({
9218
9229
  projectDir: fs.root,
@@ -9387,7 +9398,7 @@ var exportCommand = {
9387
9398
  ];
9388
9399
  if (!FORMATS.includes(format)) usage(`Unknown --format "${format}".`, `Use ${FORMATS.join(", ")}.`);
9389
9400
  const outOpt = strOpt(options, "out");
9390
- const render = () => import("./chunks/render-CN4mgGLQ.mjs");
9401
+ const render = () => import("./chunks/render-EHb40avl.mjs");
9391
9402
  if (format === "poster" || format === "video" || format === "gif") {
9392
9403
  const { parseQuality, mediaFormatFromPath } = await render();
9393
9404
  const quality = parseQuality(strOpt(options, "quality"));
@@ -9470,8 +9481,8 @@ var exportCommand = {
9470
9481
  warnings.push(`No poster: ${err.message}${err.hint ? ` (${err.hint})` : ""} — the export works without it (no image before load / without WebGL).`);
9471
9482
  }
9472
9483
  const runtime = { files: readRuntimeFiles(format) };
9473
- const { buildExport } = await import("./chunks/export-BCI8vKw8.mjs").then((n) => n.n);
9474
- const { version } = (await import("./chunks/package-BOIyp_2B.mjs").then((n) => n.n)).default;
9484
+ const { buildExport } = await import("./chunks/export-BHugc2H7.mjs").then((n) => n.n);
9485
+ const { version } = (await import("./chunks/package-fw4h5vsh.mjs").then((n) => n.n)).default;
9475
9486
  let exportFs = fs;
9476
9487
  let exportLibrary = libraryProvider();
9477
9488
  let optimizeReport;
@@ -9479,8 +9490,8 @@ var exportCommand = {
9479
9490
  if (boolOpt(options, "optimize")) {
9480
9491
  const { optimizedExportSources } = await import("./chunks/assets-BUUM9TUB.mjs").then((n) => n.d);
9481
9492
  let codec;
9482
- if ((await import("./chunks/browser-t_JL_B82.mjs")).findBrowser()) {
9483
- const c = await (await import("./chunks/imageCodec-Dz9PFxi9.mjs")).openImageCodec({ log });
9493
+ if ((await import("./chunks/browser-Br1tURgt.mjs")).findBrowser()) {
9494
+ const c = await (await import("./chunks/imageCodec-QM0EXQDJ.mjs")).openImageCodec({ log });
9484
9495
  codec = c.codec;
9485
9496
  closeCodec = c.close;
9486
9497
  } else warnings.push("--optimize: no Chrome found, textures were not resized (geometry was compressed).");
@@ -10108,7 +10119,7 @@ function runtimeIssueToIssue(i) {
10108
10119
  function nodeHost(fs) {
10109
10120
  return {
10110
10121
  ...fs ? { async render(opts) {
10111
- const { renderProject } = await import("./chunks/render-CN4mgGLQ.mjs");
10122
+ const { renderProject } = await import("./chunks/render-EHb40avl.mjs");
10112
10123
  const r = await renderProject({
10113
10124
  projectDir: fs.root,
10114
10125
  frames: opts.frames?.length ? opts.frames.join(",") : void 0,
@@ -10116,7 +10127,7 @@ function nodeHost(fs) {
10116
10127
  size: opts.size,
10117
10128
  sheet: opts.sheet ?? true,
10118
10129
  outDir: opts.out ? fs.resolve(opts.out) : void 0,
10119
- input: opts.input ? (await import("./chunks/render-CN4mgGLQ.mjs")).parseInputScript(opts.input) : void 0,
10130
+ input: opts.input ? (await import("./chunks/render-EHb40avl.mjs")).parseInputScript(opts.input) : void 0,
10120
10131
  previewWidth: opts.previewWidth,
10121
10132
  isolate: opts.isolate,
10122
10133
  bg: opts.bg,
@@ -10140,7 +10151,7 @@ function nodeHost(fs) {
10140
10151
  };
10141
10152
  } } : {},
10142
10153
  ...fs ? { async media(opts) {
10143
- const render = await import("./chunks/render-CN4mgGLQ.mjs");
10154
+ const render = await import("./chunks/render-EHb40avl.mjs");
10144
10155
  const log = (m) => void process.stderr.write(`${m}\n`);
10145
10156
  if (opts.format === "poster") {
10146
10157
  const r = await render.renderPoster({
@@ -10232,7 +10243,7 @@ function nodeHost(fs) {
10232
10243
  },
10233
10244
  inflate: (data) => new Uint8Array(inflateRawSync(data)),
10234
10245
  async withImageCodec(fn) {
10235
- const { withImageCodec } = await import("./chunks/imageCodec-Dz9PFxi9.mjs");
10246
+ const { withImageCodec } = await import("./chunks/imageCodec-QM0EXQDJ.mjs");
10236
10247
  return withImageCodec(fn, { log: (m) => void process.stderr.write(`${m}\n`) });
10237
10248
  },
10238
10249
  readLocalFile: async (path) => new Uint8Array(readFileSync(resolve(path)))
@@ -10246,7 +10257,7 @@ function toolContext(fs) {
10246
10257
  };
10247
10258
  }
10248
10259
  async function listTools(opts = {}) {
10249
- const { listAiTools } = await import("./chunks/tools-DT2tetIK.mjs");
10260
+ const { listAiTools } = await import("./chunks/tools-DKxgjQSJ.mjs");
10250
10261
  const host = nodeHost(null);
10251
10262
  return listAiTools(opts.render === false ? host : {
10252
10263
  ...host,
@@ -10259,7 +10270,7 @@ async function listTools(opts = {}) {
10259
10270
  }));
10260
10271
  }
10261
10272
  async function callTool(fs, name, input) {
10262
- const { callAiTool } = await import("./chunks/tools-DT2tetIK.mjs");
10273
+ const { callAiTool } = await import("./chunks/tools-DKxgjQSJ.mjs");
10263
10274
  return callAiTool(toolContext(fs), name, input);
10264
10275
  }
10265
10276
  function previewImages(name, result, root = ".") {
@@ -5,7 +5,7 @@ __a3dRequire(import.meta.url);
5
5
  const __filename = __a3dPath(import.meta.url);
6
6
  __a3dDirname(__filename);
7
7
  import { z as CliError } from "../agent3d.mjs";
8
- import { existsSync, mkdtempSync, readdirSync, rmSync } from "node:fs";
8
+ import { existsSync, mkdtempSync, readdirSync, rmSync, statSync } from "node:fs";
9
9
  import { homedir, tmpdir } from "node:os";
10
10
  import { execFile, spawn } from "node:child_process";
11
11
  // agent/render/browser.ts
@@ -139,7 +139,8 @@ var HEADLESS_ARGS = [
139
139
  "--autoplay-policy=no-user-gesture-required"
140
140
  ];
141
141
  function launchBrowser(info, opts = {}) {
142
- const profileDir = mkdtempSync(join(tmpdir(), "agent3d-chrome-"));
142
+ sweepStaleProfiles();
143
+ const profileDir = mkdtempSync(join(tmpdir(), PROFILE_PREFIX));
143
144
  const args = [
144
145
  ...HEADLESS_ARGS,
145
146
  `--user-data-dir=${profileDir}`,
@@ -156,9 +157,15 @@ function launchBrowser(info, opts = {}) {
156
157
  const close = async () => {
157
158
  if (closed) return;
158
159
  closed = true;
160
+ process.off("exit", onExit);
159
161
  await killProcess(child);
160
162
  removeDir(profileDir);
161
163
  };
164
+ const onExit = () => {
165
+ child.kill("SIGKILL");
166
+ removeDir(profileDir);
167
+ };
168
+ process.once("exit", onExit);
162
169
  return new Promise((resolve, reject) => {
163
170
  let stderr = "";
164
171
  const fail = (message) => {
@@ -213,6 +220,18 @@ function killProcess(child) {
213
220
  }, 2e3);
214
221
  });
215
222
  }
223
+ var PROFILE_PREFIX = "agent3d-chrome-";
224
+ var STALE_PROFILE_MS = 864e5;
225
+ function sweepStaleProfiles() {
226
+ try {
227
+ const now = Date.now();
228
+ for (const name of readdirSync(tmpdir())) {
229
+ if (!name.startsWith(PROFILE_PREFIX)) continue;
230
+ const dir = join(tmpdir(), name);
231
+ if (now - statSync(dir).mtimeMs > STALE_PROFILE_MS) removeDir(dir);
232
+ }
233
+ } catch {}
234
+ }
216
235
  function removeDir(dir) {
217
236
  try {
218
237
  rmSync(dir, {
@@ -62,6 +62,16 @@ function evalCost(formula, vars) {
62
62
  }
63
63
  i += m[0].length;
64
64
  if (m[1]) return Number(m[1]);
65
+ if ((m[2] === "min" || m[2] === "max") && peek() === "(") {
66
+ i++;
67
+ const args = [expr()];
68
+ while (peek() === ",") {
69
+ i++;
70
+ args.push(expr());
71
+ }
72
+ if (peek() === ")") i++;
73
+ return m[2] === "min" ? Math.min(...args) : Math.max(...args);
74
+ }
65
75
  const v = vars[m[2]];
66
76
  return typeof v === "number" && Number.isFinite(v) ? v : 0;
67
77
  };
@@ -73,6 +83,8 @@ function paramVars(entry, params) {
73
83
  for (const p of entry.params) {
74
84
  const v = params[p.name] !== void 0 ? params[p.name] : p.default;
75
85
  if (typeof v === "number") vars[p.name] = v;
86
+ else if (typeof v === "boolean") vars[p.name] = v ? 1 : 0;
87
+ else if (typeof v === "string" && p.type === "enum") vars[`${p.name}_${v}`] = 1;
76
88
  else if (Array.isArray(v)) {
77
89
  vars[p.name] = v.length;
78
90
  vars[`${p.name}Cells`] = v.reduce((a, x) => a + (Array.isArray(x) ? x.length : 1), 0);
@@ -7,7 +7,7 @@ __a3dDirname(__filename);
7
7
  import { t as __exportAll } from "./rolldown-runtime-ebOQtxsr.mjs";
8
8
  import { A as hasErrors, D as slugify, M as readJsonOr, N as validationError, O as KB, T as parseAspect, b as isLibraryRef, g as validateScene, k as OpsError, o as MANIFEST_FILE, p as DEFAULT_BUDGET_KB, u as readSceneFile, x as libraryId, y as findLibraryAsset } from "../agent3d.mjs";
9
9
  import { n as clone } from "./jsonPath-DUCe1JpS.mjs";
10
- import { t as attributionText } from "./check-CBO3Ekx1.mjs";
10
+ import { t as attributionText } from "./check-CfZcfaPs.mjs";
11
11
  import { c as mimeFromPath, l as visitAssetRefs, o as gltfDependencies } from "./optimizeSizing-CkZ3fZRp.mjs";
12
12
  import { c as readAssetManifest, m as crc32 } from "./assets-BUUM9TUB.mjs";
13
13
  // src/core/data.ts
@@ -5,7 +5,7 @@ __a3dRequire(import.meta.url);
5
5
  const __filename = __a3dPath(import.meta.url);
6
6
  __a3dDirname(__filename);
7
7
  import { z as CliError } from "../agent3d.mjs";
8
- import { launchBrowser, requireBrowser } from "./browser-t_JL_B82.mjs";
8
+ import { launchBrowser, requireBrowser } from "./browser-Br1tURgt.mjs";
9
9
  import { t as CdpClient } from "./cdp-Bdtm4fBN.mjs";
10
10
  // agent/render/imageCodec.ts
11
11
  var PAGE_FN = `async function (b64, mime, maxSize, quality, format, allowJpeg) {
@@ -8,14 +8,14 @@ import { t as __exportAll } from "./rolldown-runtime-ebOQtxsr.mjs";
8
8
  // package.json
9
9
  var package_exports = /* @__PURE__ */ __exportAll({ default: () => package_default });
10
10
  var name = "@fleox/agent3d";
11
- var version = "0.2.1";
11
+ var version = "0.2.3";
12
12
  var package_default = {
13
13
  name,
14
14
  version,
15
15
  type: "module",
16
16
  description: "The 3D studio your AI agent can run: describe a scene as JSON (banners, characters, landscapes, mini games), preview and screenshot it headless, and export a self-contained embed for any website. No server, no account.",
17
17
  license: "SEE LICENSE IN LICENSE",
18
- engines: { "node": ">=20" },
18
+ engines: { "node": ">=22" },
19
19
  bin: { "agent3d": "dist/agent/agent3d.mjs" },
20
20
  files: [
21
21
  "dist/agent",
@@ -7,7 +7,7 @@ __a3dDirname(__filename);
7
7
  import { t as closest } from "./suggest-Cpcgv1RP.mjs";
8
8
  import { n as findObject, o as walkObjects } from "./tree-BrNYGui2.mjs";
9
9
  import { I as libraryDir, L as runtimeBuilt, R as runtimeDir, n as startLocalServer, t as sendText, z as CliError } from "../agent3d.mjs";
10
- import { launchBrowser, requireBrowser } from "./browser-t_JL_B82.mjs";
10
+ import { launchBrowser, requireBrowser } from "./browser-Br1tURgt.mjs";
11
11
  import { t as CdpClient } from "./cdp-Bdtm4fBN.mjs";
12
12
  import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
13
13
  // agent/render/preview.ts
@@ -8,9 +8,9 @@ import { S as CATALOG, c as createProject, f as DEFAULT_ASPECT, g as validateSce
8
8
  import { t as closest } from "./suggest-Cpcgv1RP.mjs";
9
9
  import { a as listAssets, f as optimizedExportSources, i as importAssetZip, l as searchAssetsDetailed, o as listLibrary, p as SOURCE_IDS, r as downloadAsset, s as parseResolution, t as addAsset, u as optimizeAssets } from "./assets-BUUM9TUB.mjs";
10
10
  import { r as modelFileBounds } from "./gltf-f_f0-OiV.mjs";
11
- import { r as prefixFiles, t as buildExport } from "./export-BCI8vKw8.mjs";
11
+ import { r as prefixFiles, t as buildExport } from "./export-BHugc2H7.mjs";
12
12
  import { i as getAt, t as PathError } from "./jsonPath-DUCe1JpS.mjs";
13
- import { n as checkProject } from "./check-CBO3Ekx1.mjs";
13
+ import { n as checkProject } from "./check-CfZcfaPs.mjs";
14
14
  import { a as updateObject, i as removeObject, n as listObjects, t as addObject } from "./objects-DBAws7uf.mjs";
15
15
  import { i as patchScene, n as applyScene, o as summarizeScene, r as getScene, t as PATCH_OPS } from "./scene-BgajNvBf.mjs";
16
16
  // src/ai/shared.ts