@fleox/agent3d 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -11
- package/changelog.json +21 -0
- package/dist/agent/agent3d.mjs +36 -18
- package/dist/agent/chunks/{depth-Dih8jLqx.mjs → depth-BZT4gseQ.mjs} +1 -1
- package/dist/agent/chunks/{depth-0bZsQn6N.mjs → depth-CD_ql3QJ.mjs} +1 -1
- package/dist/agent/chunks/{export-Cdqt3mt_.mjs → export-CEX5DFLo.mjs} +83 -5
- package/dist/agent/chunks/{package-d5e08XSG.mjs → package-DjRnLzcU.mjs} +2 -2
- package/dist/agent/chunks/{tools-Cv6N_YBI.mjs → tools-CZyIc4zw.mjs} +16 -6
- package/dist/runtime/agent3d-photo.js +31 -0
- package/dist/runtime/agent3d-runtime.js +41 -41
- package/dist/runtime/agent3d-runtime.single.js +252 -247
- package/dist/runtime/chunks/assets-kC2Z1Xy_.js +1 -0
- package/dist/runtime/chunks/game-CbQaEB4q.js +20 -0
- package/dist/runtime/chunks/materials-jwhXlLYl.js +107 -0
- package/dist/runtime/chunks/model-CG5T_jcB.js +1 -0
- package/dist/runtime/chunks/num-CQNAlL82.js +1 -0
- package/dist/runtime/chunks/{photo-BlDYgYFM.js → photo-w6dwHX7j.js} +27 -22
- package/dist/runtime/chunks/physicsHost-BU-2V-CZ.js +1 -0
- package/dist/runtime/chunks/{postfx-Cbf_vvOr.js → postfx-DnIeKXAh.js} +1 -1
- package/dist/runtime/chunks/postfx-ylpcQcVK.js +1 -0
- package/dist/runtime/chunks/svg-fYjsY-rV.js +1 -0
- package/dist/runtime/chunks/{text-rSo_2Luk.js → text-CySfj5sH.js} +1 -1
- package/dist/runtime/chunks/util-BEflQURG.js +1 -0
- package/dist/studio/assets/assets--ehPZf8R.js +1 -0
- package/dist/studio/assets/camera-C0sxfRxy.js +2 -0
- package/dist/studio/assets/{editor-BjgHj9g8.js → editor-DzyukvQl.js} +1 -1
- package/dist/studio/assets/game-DNpTN_Ga.js +19 -0
- package/dist/studio/assets/{generators-DqkPMEzm.js → generators-BuVeRXnC.js} +5 -5
- package/dist/studio/assets/index-C2nMYSoW.js +479 -0
- package/dist/studio/assets/model-DQgOrTs4.js +2 -0
- package/dist/studio/assets/num-CQNAlL82.js +1 -0
- package/dist/studio/assets/{params-gVpEEiSK.js → params-D-Ul6GSt.js} +1 -1
- package/dist/studio/assets/{photo-DRoVO5iZ.js → photo-Dx2IBJ11.js} +27 -22
- package/dist/studio/assets/physicsHost-z9qn_mpg.js +1 -0
- package/dist/studio/assets/{postfx-JFUGdY0d.js → postfx-B3jDEaEK.js} +13 -13
- package/dist/studio/assets/runtime-rd9RW3WH.js +572 -0
- package/dist/studio/assets/{shaders-C7u6rN_6.js → shaders-bFhELLmD.js} +1 -1
- package/dist/studio/assets/svg-BkV9LeqP.js +2 -0
- package/dist/studio/assets/{text-LISSAism.js → text-Dp8gdjSA.js} +1 -1
- package/dist/studio/index.html +1 -1
- package/package.json +2 -2
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/skills/agent3d-assets/SKILL.md +27 -27
- package/plugin/skills/agent3d-create/SKILL.md +28 -27
- package/plugin/skills/agent3d-create/references/art-direction.md +3 -3
- package/plugin/skills/agent3d-create/references/recipes.md +6 -6
- package/plugin/skills/agent3d-edit/SKILL.md +22 -22
- package/plugin/skills/agent3d-edit/references/patch-ops.md +2 -2
- package/plugin/skills/agent3d-game/SKILL.md +7 -7
- package/plugin/skills/agent3d-publish/SKILL.md +24 -22
- package/plugin/skills/agent3d-publish/references/integrations.md +1 -1
- package/templates/hero-photo-3d/assets/depth/street-depth.png +0 -0
- package/templates/hero-photo-3d/assets/manifest.json +3 -3
- package/templates/hero-photo-3d/assets/textures/street.webp +0 -0
- package/templates/hero-photo-3d/scene.json +1 -1
- package/dist/runtime/chunks/assets-qnxDnVkj.js +0 -1
- package/dist/runtime/chunks/game-BoEiyZrL.js +0 -20
- package/dist/runtime/chunks/materials-dC4vDNHh.js +0 -107
- package/dist/runtime/chunks/model-BCAl_NRl.js +0 -1
- package/dist/runtime/chunks/physicsHost-ChPgysMQ.js +0 -1
- package/dist/runtime/chunks/postfx-CFucYRev.js +0 -1
- package/dist/runtime/chunks/svg-CLUxY6Zy.js +0 -1
- package/dist/runtime/chunks/util-CyaW1fcW.js +0 -1
- package/dist/studio/assets/assets-BFJsr9Oo.js +0 -1
- package/dist/studio/assets/camera-DT0xHipx.js +0 -2
- package/dist/studio/assets/game-BXZEc9HN.js +0 -19
- package/dist/studio/assets/index-DVTzVcBD.js +0 -479
- package/dist/studio/assets/model-BqQW4Dg-.js +0 -2
- package/dist/studio/assets/physicsHost-DNdZ7AsT.js +0 -1
- package/dist/studio/assets/runtime-CMAP4azF.js +0 -572
- package/dist/studio/assets/svg-DkIOJjzS.js +0 -2
- package/templates/hero-photo-3d/assets/textures/street.jpg +0 -0
package/README.md
CHANGED
|
@@ -109,19 +109,19 @@ Once the scene exists, changing it is a conversation:
|
|
|
109
109
|
### Without an agent
|
|
110
110
|
|
|
111
111
|
```bash
|
|
112
|
-
npx -y @fleox/agent3d@0.
|
|
113
|
-
npx -y @fleox/agent3d@0.
|
|
112
|
+
npx -y @fleox/agent3d@0.4.0 new bakery --target banner --title "Golden Crust"
|
|
113
|
+
npx -y @fleox/agent3d@0.4.0 studio --project bakery
|
|
114
114
|
```
|
|
115
115
|
|
|
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.
|
|
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.4.0 doctor` checks your setup with a test render.
|
|
117
117
|
|
|
118
118
|
The whole loop from a terminal:
|
|
119
119
|
|
|
120
120
|
```bash
|
|
121
|
-
npx -y @fleox/agent3d@0.
|
|
122
|
-
npx -y @fleox/agent3d@0.
|
|
123
|
-
npx -y @fleox/agent3d@0.
|
|
124
|
-
npx -y @fleox/agent3d@0.
|
|
121
|
+
npx -y @fleox/agent3d@0.4.0 scene patch --project bakery '[{"op":"set","path":"objects#title.material","value":{"preset":"gold"}}]'
|
|
122
|
+
npx -y @fleox/agent3d@0.4.0 render --project bakery --sheet # → renders/…-sheet.png
|
|
123
|
+
npx -y @fleox/agent3d@0.4.0 check --project bakery
|
|
124
|
+
npx -y @fleox/agent3d@0.4.0 export --project bakery # → dist/embed/ + the snippet
|
|
125
125
|
```
|
|
126
126
|
|
|
127
127
|
Step by step: [docs/getting-started.md](https://github.com/fleox/agent3d/blob/main/docs/getting-started.md).
|
|
@@ -171,7 +171,7 @@ Step by step: [docs/getting-started.md](https://github.com/fleox/agent3d/blob/ma
|
|
|
171
171
|
- 22 procedural **generators**: terrain (mountains, basins, valleys, islands), trees, rocks, grass, flowers, water with mirror reflections, clouds, birds, cities, roads, floating islands, globes, galaxies, crystals, 3D bar charts, mazes… deterministic from a seed
|
|
172
172
|
- A procedural **character** generator (humanoid, astronaut, robot, blob, cat, fox, bird, ghost) with animations such as wave, run, jump, dance and celebrate
|
|
173
173
|
- A built-in **library** of 179 assets usable offline (`library:<id>`): 128 models (rigged characters with clips, products, props), PBR textures and HDRIs; optional search and download from free CC0 sources (Poly Haven, ambientCG, Khronos samples) and Kenney / Quaternius pack import, with licences recorded
|
|
174
|
-
- **3D photos**: any photo plus a depth map estimated on your machine (`assets depth`: Depth Anything V2 Small, a 27 MB model downloaded once, then offline) moves in depth with the pointer, the phone's gyroscope, the scroll or a gentle automatic drift — shader parallax, a displaced mesh or pop-up layers
|
|
174
|
+
- **3D photos**: any photo plus a depth map estimated on your machine (`assets depth`: Depth Anything V2 Small, a 27 MB model downloaded once, then offline) moves in depth with the pointer, the phone's gyroscope, the scroll or a gentle automatic drift — shader parallax, a displaced mesh or pop-up layers; a photo-only hero exports with a 14 KB player instead of three.js
|
|
175
175
|
- 3D text in 13 kerned **fonts** with wrapping, outlines and letter-by-letter reveals; extruded **SVG logos** that keep their colours; 17 particle presets; 12 synth sounds
|
|
176
176
|
|
|
177
177
|
**Games**
|
|
@@ -194,7 +194,7 @@ Step by step: [docs/getting-started.md](https://github.com/fleox/agent3d/blob/ma
|
|
|
194
194
|
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.
|
|
195
195
|
|
|
196
196
|
```bash
|
|
197
|
-
npx -y @fleox/agent3d@0.
|
|
197
|
+
npx -y @fleox/agent3d@0.4.0 studio --project bakery
|
|
198
198
|
```
|
|
199
199
|
|
|
200
200
|
<p align="center">
|
|
@@ -323,7 +323,7 @@ Pick Spline when a designer wants a hosted visual tool, hand-written Three.js wh
|
|
|
323
323
|
|
|
324
324
|
## The `agent3d` CLI
|
|
325
325
|
|
|
326
|
-
The same engine the agents use, by hand: `npx -y @fleox/agent3d@0.
|
|
326
|
+
The same engine the agents use, by hand: `npx -y @fleox/agent3d@0.4.0 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`.
|
|
327
327
|
|
|
328
328
|
<p align="center">
|
|
329
329
|
<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">
|
|
@@ -361,7 +361,7 @@ Full reference: [docs/cli.md](https://github.com/fleox/agent3d/blob/main/docs/cl
|
|
|
361
361
|
## MCP server
|
|
362
362
|
|
|
363
363
|
```bash
|
|
364
|
-
claude mcp add agent3d -- npx -y @fleox/agent3d@0.
|
|
364
|
+
claude mcp add agent3d -- npx -y @fleox/agent3d@0.4.0 mcp --project ~/agent3d/my-banner
|
|
365
365
|
```
|
|
366
366
|
|
|
367
367
|
<p align="center">
|
package/changelog.json
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"versions": [
|
|
3
|
+
{
|
|
4
|
+
"version": "0.4.0",
|
|
5
|
+
"date": "2026-11-26",
|
|
6
|
+
"breaking": false,
|
|
7
|
+
"changes": [
|
|
8
|
+
"Photo-only exports load a 14 KB player instead of three.js: when the scene is a single 3D photo in parallax mode (no text, effects, timeline…), `export` ships `agent3d-photo.js` (raw WebGL2, the same `<agent3d-scene>` element, same pixels) — the landscape demo's runtime JavaScript went from ~242 KB to ~14 KB gzip. `export --runtime full` (and the `export` tool's `runtime`) keeps the full runtime; the result reports `runtime: \"photo-lite\" | \"full\"` and, when full, why.",
|
|
9
|
+
"A page that also shows a scene the photo player cannot render loads the full runtime for that element automatically."
|
|
10
|
+
],
|
|
11
|
+
"actions": []
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"version": "0.3.1",
|
|
15
|
+
"date": "2026-11-26",
|
|
16
|
+
"breaking": false,
|
|
17
|
+
"changes": [
|
|
18
|
+
"3D photos load faster: `assets depth` writes the depth map at 1024 px by default (the model works at 518 px; the template's map went from 185 KB to 80 KB at the same look), and the `hero-photo-3d` template ships its photo as WebP (552 KB → 330 KB). Skills recommend `assets optimize --all` before exporting a photo hero.",
|
|
19
|
+
"Parallax photos spend fewer shader steps on weak devices (quality tiers) and with gentle depth.",
|
|
20
|
+
"Exports: heroes and full-screen scenes give their poster `fetchpriority=\"high\"` (it is usually the page's largest image)."
|
|
21
|
+
],
|
|
22
|
+
"actions": []
|
|
23
|
+
},
|
|
3
24
|
{
|
|
4
25
|
"version": "0.3.0",
|
|
5
26
|
"date": "2026-11-26",
|
package/dist/agent/agent3d.mjs
CHANGED
|
@@ -6,7 +6,7 @@ __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-
|
|
9
|
+
import { r as version, t as package_default } from "./chunks/package-DjRnLzcU.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";
|
|
@@ -3623,6 +3623,14 @@ function libraryId(ref) {
|
|
|
3623
3623
|
function findLibraryAsset(index, id) {
|
|
3624
3624
|
return index?.assets.find((a) => a.id === id);
|
|
3625
3625
|
}
|
|
3626
|
+
// src/core/qualityTier.ts
|
|
3627
|
+
/** Upper bound of the device pixel ratio per tier (combined with target.maxDpr). */
|
|
3628
|
+
var TIER_DPR_CAP = {
|
|
3629
|
+
low: 1,
|
|
3630
|
+
medium: 1.5,
|
|
3631
|
+
high: 2,
|
|
3632
|
+
ultra: 3
|
|
3633
|
+
};
|
|
3626
3634
|
// src/core/postfx.ts
|
|
3627
3635
|
var SCALED = /* @__PURE__ */ new Set([
|
|
3628
3636
|
"strength",
|
|
@@ -3692,7 +3700,7 @@ function qualitySettings(tier) {
|
|
|
3692
3700
|
switch (tier) {
|
|
3693
3701
|
case "low": return {
|
|
3694
3702
|
tier,
|
|
3695
|
-
dprCap:
|
|
3703
|
+
dprCap: TIER_DPR_CAP.low,
|
|
3696
3704
|
msaa: 0,
|
|
3697
3705
|
effectScale: .5,
|
|
3698
3706
|
maxCost: "medium",
|
|
@@ -3703,7 +3711,7 @@ function qualitySettings(tier) {
|
|
|
3703
3711
|
};
|
|
3704
3712
|
case "medium": return {
|
|
3705
3713
|
tier,
|
|
3706
|
-
dprCap:
|
|
3714
|
+
dprCap: TIER_DPR_CAP.medium,
|
|
3707
3715
|
msaa: 4,
|
|
3708
3716
|
effectScale: .5,
|
|
3709
3717
|
maxCost: "high",
|
|
@@ -3714,7 +3722,7 @@ function qualitySettings(tier) {
|
|
|
3714
3722
|
};
|
|
3715
3723
|
case "ultra": return {
|
|
3716
3724
|
tier,
|
|
3717
|
-
dprCap:
|
|
3725
|
+
dprCap: TIER_DPR_CAP.ultra,
|
|
3718
3726
|
msaa: 8,
|
|
3719
3727
|
effectScale: 1,
|
|
3720
3728
|
maxCost: "high",
|
|
@@ -3725,7 +3733,7 @@ function qualitySettings(tier) {
|
|
|
3725
3733
|
};
|
|
3726
3734
|
default: return {
|
|
3727
3735
|
tier: "high",
|
|
3728
|
-
dprCap:
|
|
3736
|
+
dprCap: TIER_DPR_CAP.high,
|
|
3729
3737
|
msaa: 4,
|
|
3730
3738
|
effectScale: .5,
|
|
3731
3739
|
maxCost: "high",
|
|
@@ -7905,7 +7913,7 @@ function readRuntimeFiles(format = "embed") {
|
|
|
7905
7913
|
const files = {};
|
|
7906
7914
|
for (const f of walkFiles(root)) {
|
|
7907
7915
|
if (f.endsWith(".map")) continue;
|
|
7908
|
-
if (format === "single-html" ? f === "agent3d-runtime.single.js" : f !== "agent3d-runtime.single.js" && f !== "version.json") files[f] = new Uint8Array(readFileSync(join(root, f)));
|
|
7916
|
+
if (format === "single-html" ? f === "agent3d-runtime.single.js" || f === "agent3d-photo.js" : f !== "agent3d-runtime.single.js" && f !== "version.json") files[f] = new Uint8Array(readFileSync(join(root, f)));
|
|
7909
7917
|
}
|
|
7910
7918
|
if (format === "single-html" && !files["agent3d-runtime.single.js"]) throw new CliError("runtime-missing", `The single-file runtime is missing (${join(root, RUNTIME_SINGLE)}).`, "Run `npm run build:runtime` (it builds both runtimes), or export --format embed.");
|
|
7911
7919
|
return files;
|
|
@@ -8295,8 +8303,8 @@ var assetsCommand = {
|
|
|
8295
8303
|
},
|
|
8296
8304
|
{
|
|
8297
8305
|
name: "depth",
|
|
8298
|
-
usage: "assets depth <image> [--out assets/depth/<name>-depth.png] [--size 518] [--max-size
|
|
8299
|
-
summary: "Estimate a depth map for a photo of the project (or \"library:<id>\") with Depth Anything V2 Small, run locally in headless Chrome (onnxruntime-web, WASM). Writes a grey PNG (white = near, transparent on depth jumps) at the photo size (capped by --max-size, default
|
|
8306
|
+
usage: "assets depth <image> [--out assets/depth/<name>-depth.png] [--size 518] [--max-size 1024]",
|
|
8307
|
+
summary: "Estimate a depth map for a photo of the project (or \"library:<id>\") with Depth Anything V2 Small, run locally in headless Chrome (onnxruntime-web, WASM). Writes a grey PNG (white = near, transparent on depth jumps) at the photo size (capped by --max-size, default 1024) to use as a photo object's `depth`, registered in assets/manifest.json with the photo's licence. The model (27 MB, Apache-2.0) is downloaded once into ~/.agent3d/models (AGENT3D_MODELS overrides); later runs work offline. --size is the model input long side (default 518, up to 1036 for finer edges, slower).",
|
|
8300
8308
|
writes: true
|
|
8301
8309
|
},
|
|
8302
8310
|
{
|
|
@@ -8368,7 +8376,7 @@ var assetsCommand = {
|
|
|
8368
8376
|
{
|
|
8369
8377
|
name: "max-size",
|
|
8370
8378
|
type: "string",
|
|
8371
|
-
description: "optimize / add --hit: longest texture side in pixels, for every texture (optimize default: a smart size per texture from the scene; never upscales). depth: longest side of the depth map (default
|
|
8379
|
+
description: "optimize / add --hit: longest texture side in pixels, for every texture (optimize default: a smart size per texture from the scene; never upscales). depth: longest side of the depth map (default 1024)."
|
|
8372
8380
|
},
|
|
8373
8381
|
{
|
|
8374
8382
|
name: "quality",
|
|
@@ -8636,7 +8644,7 @@ var assetsCommand = {
|
|
|
8636
8644
|
}
|
|
8637
8645
|
if (action === "depth") {
|
|
8638
8646
|
const image = positional(rest, 0, "image (project path or library:<id>)", "assets depth assets/textures/photo.jpg");
|
|
8639
|
-
const { checkDepthRequest, estimateDepth } = await import("./chunks/depth-
|
|
8647
|
+
const { checkDepthRequest, estimateDepth } = await import("./chunks/depth-BZT4gseQ.mjs").then((n) => n.r);
|
|
8640
8648
|
const { deflateSync } = await import("node:zlib");
|
|
8641
8649
|
const req = {
|
|
8642
8650
|
image: image.replace(/^\.\//, ""),
|
|
@@ -8648,7 +8656,7 @@ var assetsCommand = {
|
|
|
8648
8656
|
};
|
|
8649
8657
|
if (req.maxSize !== void 0 && !(req.maxSize >= 16 && req.maxSize <= 8192)) usage(`--max-size must be between 16 and 8192, got ${req.maxSize}.`, "e.g. --max-size 1024 (default 2048).");
|
|
8650
8658
|
await checkDepthRequest(fs, req);
|
|
8651
|
-
const { withDepthEstimator } = await import("./chunks/depth-
|
|
8659
|
+
const { withDepthEstimator } = await import("./chunks/depth-CD_ql3QJ.mjs");
|
|
8652
8660
|
const r = await withDepthEstimator((estimator) => estimateDepth(fs, req, estimator), { log: log$1 });
|
|
8653
8661
|
return printResult(io, {
|
|
8654
8662
|
...r,
|
|
@@ -9452,7 +9460,7 @@ function dirNonEmpty(dir) {
|
|
|
9452
9460
|
}
|
|
9453
9461
|
var exportCommand = {
|
|
9454
9462
|
name: "export",
|
|
9455
|
-
usage: "export [--format embed|zip|single-html|poster|video|gif] [--out <path>] [--name <slug>] [--base-url <url>] [--cache-bust] [--no-integrity] [--no-poster] [--no-og] [--prune-runtime] [--yes] [--project <dir>]",
|
|
9463
|
+
usage: "export [--format embed|zip|single-html|poster|video|gif] [--out <path>] [--name <slug>] [--base-url <url>] [--cache-bust] [--no-integrity] [--no-poster] [--no-og] [--prune-runtime] [--runtime auto|full] [--yes] [--project <dir>]",
|
|
9456
9464
|
summary: "Export for a website: embed (Web Component + static files + EMBED.md + React/Vue/Svelte wrappers, default), zip (the embed folder as one .zip), single-html (one file), poster (still image), video (MP4 H.264 / WebM VP9) or gif. Reports pageKb / pageKbGzip (what a visitor downloads for this scene: runtime entry + the chunks it loads + scene, assets, scripts, poster) and folderKb (every file written). Overwriting a non-empty --out needs --yes.",
|
|
9457
9465
|
writes: true,
|
|
9458
9466
|
options: [
|
|
@@ -9502,6 +9510,11 @@ var exportCommand = {
|
|
|
9502
9510
|
type: "boolean",
|
|
9503
9511
|
description: "embed / zip: copy only the runtime chunks this scene loads (smaller folder). Only for a runtime folder used by this scene alone — other scenes sharing it may need the left-out chunks; kept whole when a chunk's feature is unknown."
|
|
9504
9512
|
},
|
|
9513
|
+
{
|
|
9514
|
+
name: "runtime",
|
|
9515
|
+
type: "string",
|
|
9516
|
+
description: "embed / zip / single-html: auto (default) ships the photo-only lite runtime (agent3d-photo.js, ~14 KB gzipped, no three.js) when the scene is a single 3D photo with a fixed camera and a plain background; full always ships agent3d-runtime.js. The result's runtime / runtimeReasons say which and why."
|
|
9517
|
+
},
|
|
9505
9518
|
{
|
|
9506
9519
|
name: "no-og",
|
|
9507
9520
|
type: "boolean",
|
|
@@ -9649,9 +9662,11 @@ var exportCommand = {
|
|
|
9649
9662
|
const err = e;
|
|
9650
9663
|
warnings.push(`No poster: ${err.message}${err.hint ? ` (${err.hint})` : ""} — the export works without it (no image before load / without WebGL).`);
|
|
9651
9664
|
}
|
|
9665
|
+
const runtimeChoice = strOpt(options, "runtime") ?? "auto";
|
|
9666
|
+
if (runtimeChoice !== "auto" && runtimeChoice !== "full") usage(`Unknown --runtime "${runtimeChoice}".`, "Use auto (default: the photo-only lite runtime for single-3D-photo scenes) or full.");
|
|
9652
9667
|
const runtime = { files: readRuntimeFiles(format) };
|
|
9653
|
-
const { buildExport } = await import("./chunks/export-
|
|
9654
|
-
const { version } = (await import("./chunks/package-
|
|
9668
|
+
const { buildExport } = await import("./chunks/export-CEX5DFLo.mjs").then((n) => n.n);
|
|
9669
|
+
const { version } = (await import("./chunks/package-DjRnLzcU.mjs").then((n) => n.n)).default;
|
|
9655
9670
|
let exportFs = fs;
|
|
9656
9671
|
let exportLibrary = libraryProvider();
|
|
9657
9672
|
let optimizeReport;
|
|
@@ -9682,6 +9697,7 @@ var exportCommand = {
|
|
|
9682
9697
|
integrity: !boolOpt(options, "no-integrity"),
|
|
9683
9698
|
extras: !boolOpt(options, "no-extras"),
|
|
9684
9699
|
pruneRuntime: boolOpt(options, "prune-runtime"),
|
|
9700
|
+
runtimeChoice,
|
|
9685
9701
|
version
|
|
9686
9702
|
}).finally(() => closeCodec?.());
|
|
9687
9703
|
const optimized = optimizeReport?.();
|
|
@@ -9707,6 +9723,8 @@ var exportCommand = {
|
|
|
9707
9723
|
totalKb: r.totalKb,
|
|
9708
9724
|
sizes: r.sizes,
|
|
9709
9725
|
page: r.page,
|
|
9726
|
+
runtime: r.runtime,
|
|
9727
|
+
...r.runtimeReasons ? { runtimeReasons: r.runtimeReasons } : {},
|
|
9710
9728
|
...optimized ? { optimized } : {},
|
|
9711
9729
|
credits: r.credits,
|
|
9712
9730
|
issues: r.issues,
|
|
@@ -9714,7 +9732,7 @@ var exportCommand = {
|
|
|
9714
9732
|
...warnings.length ? { warnings } : {}
|
|
9715
9733
|
}, () => [
|
|
9716
9734
|
`Exported ${format} → ${out} (folder ${r.folderKb} KB, ${written.length} files)`,
|
|
9717
|
-
`Page weight: ${r.pageKb} KB${r.pageKbGzip !== void 0 ? ` (${r.pageKbGzip} KB gzipped)` : ""} — runtime ${r.page.runtimeKb} KB (${r.page.runtimeFiles.length} files; ${r.page.skippedChunks.length} lazy chunks this scene never loads${r.page.pruned ? ", left out" : ""}) + scene, assets, scripts, poster.`,
|
|
9735
|
+
r.runtime === "photo-lite" ? `Page weight: ${r.pageKb} KB${r.pageKbGzip !== void 0 ? ` (${r.pageKbGzip} KB gzipped)` : ""} — photo-only lite runtime ${r.page.runtimeKb} KB (agent3d-photo.js, no three.js) + scene, assets, poster.` : `Page weight: ${r.pageKb} KB${r.pageKbGzip !== void 0 ? ` (${r.pageKbGzip} KB gzipped)` : ""} — runtime ${r.page.runtimeKb} KB (${r.page.runtimeFiles.length} files; ${r.page.skippedChunks.length} lazy chunks this scene never loads${r.page.pruned ? ", left out" : ""}) + scene, assets, scripts, poster.`,
|
|
9718
9736
|
`Open: ${entry}`,
|
|
9719
9737
|
...optimized ? [`Optimised asset copies: ${optimized.beforeKb} → ${optimized.afterKb} KB (saved ${optimized.savedKb} KB; the project is unchanged).`] : [],
|
|
9720
9738
|
...format === "zip" ? [] : [
|
|
@@ -10417,7 +10435,7 @@ function nodeHost(fs) {
|
|
|
10417
10435
|
return withImageCodec(fn, { log: (m) => void process.stderr.write(`${m}\n`) });
|
|
10418
10436
|
},
|
|
10419
10437
|
async withDepthEstimator(fn) {
|
|
10420
|
-
const { withDepthEstimator } = await import("./chunks/depth-
|
|
10438
|
+
const { withDepthEstimator } = await import("./chunks/depth-CD_ql3QJ.mjs");
|
|
10421
10439
|
return withDepthEstimator(fn, { log: (m) => void process.stderr.write(`${m}\n`) });
|
|
10422
10440
|
},
|
|
10423
10441
|
deflate: (data) => new Uint8Array(deflateSync(data)),
|
|
@@ -10432,7 +10450,7 @@ function toolContext(fs) {
|
|
|
10432
10450
|
};
|
|
10433
10451
|
}
|
|
10434
10452
|
async function listTools(opts = {}) {
|
|
10435
|
-
const { listAiTools } = await import("./chunks/tools-
|
|
10453
|
+
const { listAiTools } = await import("./chunks/tools-CZyIc4zw.mjs");
|
|
10436
10454
|
const host = nodeHost(null);
|
|
10437
10455
|
return listAiTools(opts.render === false ? host : {
|
|
10438
10456
|
...host,
|
|
@@ -10445,7 +10463,7 @@ async function listTools(opts = {}) {
|
|
|
10445
10463
|
}));
|
|
10446
10464
|
}
|
|
10447
10465
|
async function callTool(fs, name, input) {
|
|
10448
|
-
const { callAiTool } = await import("./chunks/tools-
|
|
10466
|
+
const { callAiTool } = await import("./chunks/tools-CZyIc4zw.mjs");
|
|
10449
10467
|
return callAiTool(toolContext(fs), name, input);
|
|
10450
10468
|
}
|
|
10451
10469
|
function previewImages(name, result, root = ".") {
|
|
@@ -431,7 +431,7 @@ async function estimateDepth(fs, opts, estimator) {
|
|
|
431
431
|
if (r.depth.length !== r.width * r.height) throw new OpsError("io", `The depth estimator returned ${r.depth.length} values for ${r.width}x${r.height}.`);
|
|
432
432
|
const srcW = r.srcWidth || header.width;
|
|
433
433
|
const srcH = r.srcHeight || header.height;
|
|
434
|
-
const k = Math.min(opts.maxSize ??
|
|
434
|
+
const k = Math.min(opts.maxSize ?? 1024, Math.max(srcW, srcH)) / Math.max(srcW, srcH);
|
|
435
435
|
const map = postprocessDepth(r.depth, r.width, r.height, {
|
|
436
436
|
width: Math.max(1, Math.round(srcW * k)),
|
|
437
437
|
height: Math.max(1, Math.round(srcH * k)),
|
|
@@ -4,7 +4,7 @@ import { dirname as __a3dDirname, dirname, join, resolve } from "node:path";
|
|
|
4
4
|
__a3dRequire(import.meta.url);
|
|
5
5
|
const __filename = __a3dPath(import.meta.url);
|
|
6
6
|
__a3dDirname(__filename);
|
|
7
|
-
import { i as ensureDepthModel, t as DEPTH_MODEL } from "./depth-
|
|
7
|
+
import { i as ensureDepthModel, t as DEPTH_MODEL } from "./depth-BZT4gseQ.mjs";
|
|
8
8
|
import { H as CliError, L as ORT_FILES, r as startLocalServer, t as mimeOf, z as ortDir } from "../agent3d.mjs";
|
|
9
9
|
import { launchBrowser, requireBrowser } from "./browser-Dil7VM5m.mjs";
|
|
10
10
|
import { t as CdpClient } from "./cdp-DLEis_Z3.mjs";
|
|
@@ -47,6 +47,69 @@ function base64Encode(bytes) {
|
|
|
47
47
|
function dataUri(bytes, mime) {
|
|
48
48
|
return `data:${mime};base64,${base64Encode(bytes)}`;
|
|
49
49
|
}
|
|
50
|
+
// src/ops/liteRuntime.ts
|
|
51
|
+
var LITE_RUNTIME_FILE = "agent3d-photo.js";
|
|
52
|
+
var HEX = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
53
|
+
var nonEmpty = (v) => Array.isArray(v) ? v.length > 0 : v !== void 0 && v !== null && v !== false;
|
|
54
|
+
function liteRuntimeEligibility(scene) {
|
|
55
|
+
const reasons = [];
|
|
56
|
+
const no = (cond, why) => {
|
|
57
|
+
if (cond) reasons.push(why);
|
|
58
|
+
};
|
|
59
|
+
const s = scene ?? {};
|
|
60
|
+
no((s.target ?? {}).kind === "game", "target.kind is game");
|
|
61
|
+
no(nonEmpty(s.timeline), "timeline");
|
|
62
|
+
no(nonEmpty(s.interactions), "interactions");
|
|
63
|
+
no(nonEmpty(s.postfx), "post effects (postfx)");
|
|
64
|
+
no(nonEmpty(s.physics), "physics");
|
|
65
|
+
no(nonEmpty(s.scripts), "scripts");
|
|
66
|
+
no(s.ui?.elements?.length, "ui (HUD)");
|
|
67
|
+
no(nonEmpty(s.audio), "audio");
|
|
68
|
+
no(/\{data\./.test(JSON.stringify(scene ?? {})), "data bindings ({data.*} placeholders)");
|
|
69
|
+
const cam = s.camera;
|
|
70
|
+
if (!cam || cam.type !== "perspective") reasons.push("camera is not perspective");
|
|
71
|
+
else {
|
|
72
|
+
no(cam.controls && cam.controls !== "none", `camera.controls "${cam.controls}"`);
|
|
73
|
+
no(cam.autoRotate, "camera.autoRotate");
|
|
74
|
+
no(nonEmpty(cam.shots), "camera.shots");
|
|
75
|
+
no(cam.shake, "camera.shake");
|
|
76
|
+
no(cam.lookAt, "camera.lookAt");
|
|
77
|
+
no(cam.follow, "camera.follow");
|
|
78
|
+
}
|
|
79
|
+
const env = s.environment;
|
|
80
|
+
const bg = env?.background;
|
|
81
|
+
no(bg !== void 0 && (typeof bg !== "string" || bg !== "transparent" && !HEX.test(bg)), "environment.background is not a #hex colour or transparent");
|
|
82
|
+
no(env?.ground, "environment.ground");
|
|
83
|
+
no(env?.contactShadows, "environment.contactShadows");
|
|
84
|
+
no(env?.rig, "environment.rig (light rig)");
|
|
85
|
+
for (const l of s.lights ?? []) {
|
|
86
|
+
no(l.type === "rect", "rect lights (visible panels)");
|
|
87
|
+
no(l.type === "spot" && l.volumetric, "volumetric spot lights");
|
|
88
|
+
}
|
|
89
|
+
const objects = s.objects ?? [];
|
|
90
|
+
if (objects.length !== 1) reasons.push(`${objects.length} objects (the lite runtime shows exactly one photo)`);
|
|
91
|
+
const o = objects[0];
|
|
92
|
+
if (o && o.kind !== "photo") reasons.push(`object "${o.id}" is a ${o.kind}, not a photo`);
|
|
93
|
+
else if (o) {
|
|
94
|
+
const p = o;
|
|
95
|
+
no(!!p.depth && p.mode && p.mode !== "parallax", `photo mode "${p.mode}" (lite: parallax or a flat photo)`);
|
|
96
|
+
no(nonEmpty(p.children), "photo has children");
|
|
97
|
+
no(p.visible === false, "photo is hidden");
|
|
98
|
+
no(nonEmpty(p.behaviours), "photo behaviours");
|
|
99
|
+
no(p.body, "photo physics body");
|
|
100
|
+
no(p.href, "photo link (href)");
|
|
101
|
+
no(p.attach, "photo attached to the camera");
|
|
102
|
+
no(Array.isArray(p.rotation) && p.rotation.some((r) => r !== 0), "photo is rotated");
|
|
103
|
+
const sc = p.scale;
|
|
104
|
+
no(sc !== void 0 && (typeof sc === "number" ? !(sc > 0) : !Array.isArray(sc) || !(sc[0] > 0 && sc[1] > 0)), "photo scale is not positive");
|
|
105
|
+
no(p.material?.color !== void 0 && !(typeof p.material.color === "string" && HEX.test(p.material.color)), "photo material.color is not a #hex colour");
|
|
106
|
+
no(typeof p.src !== "string" || !p.src, "photo has no src");
|
|
107
|
+
}
|
|
108
|
+
return reasons.length ? {
|
|
109
|
+
ok: false,
|
|
110
|
+
reasons
|
|
111
|
+
} : { ok: true };
|
|
112
|
+
}
|
|
50
113
|
// src/ops/runtimeChunks.ts
|
|
51
114
|
var hasKind = (scene, kinds) => {
|
|
52
115
|
const walk = (objs) => !!objs?.some((o) => kinds.includes(o.kind) || walk(o.children));
|
|
@@ -223,7 +286,7 @@ function pageRuntime(files, entry, scene) {
|
|
|
223
286
|
}
|
|
224
287
|
}
|
|
225
288
|
}
|
|
226
|
-
const js = Object.keys(files).filter((f) => f.endsWith(".js") && !f.endsWith(".single.js"));
|
|
289
|
+
const js = Object.keys(files).filter((f) => f.endsWith(".js") && !f.endsWith(".single.js") && f !== "agent3d-photo.js");
|
|
227
290
|
return {
|
|
228
291
|
loaded: [...loaded],
|
|
229
292
|
skipped: js.filter((f) => !loaded.has(f)),
|
|
@@ -703,7 +766,8 @@ function resolveRel(dir, rel) {
|
|
|
703
766
|
}
|
|
704
767
|
function posterMarkup(p) {
|
|
705
768
|
const dims = p.size ? ` width="${Math.round(p.size.width)}" height="${Math.round(p.size.height)}"` : "";
|
|
706
|
-
const
|
|
769
|
+
const prio = p.priority ? " fetchpriority=\"high\"" : "";
|
|
770
|
+
const img = (slot) => `<img${slot ? " slot=\"poster\"" : ""} src="${escapeHtml(p.src)}" alt="${escapeHtml(p.alt)}"${dims}${prio} decoding="async" style="display:block;width:100%;height:auto">`;
|
|
707
771
|
if (!p.avif) return img(true);
|
|
708
772
|
return `<picture slot="poster"><source type="image/avif" srcset="${escapeHtml(p.avif)}">${img(false)}</picture>`;
|
|
709
773
|
}
|
|
@@ -755,7 +819,13 @@ async function buildExport(fs, opts) {
|
|
|
755
819
|
if (hasErrors(issues)) throw validationError("Cannot export an invalid scene:", issues, "Run check / scene_validate and fix the errors first.");
|
|
756
820
|
const projectManifest = await readJsonOr(fs, MANIFEST_FILE, null);
|
|
757
821
|
const name = slugify(opts.name ?? projectManifest?.name ?? source.id ?? "scene", "scene");
|
|
758
|
-
const
|
|
822
|
+
const choice = opts.runtimeChoice ?? "auto";
|
|
823
|
+
if (choice !== "auto" && choice !== "full") throw new OpsError("invalid", `Unknown runtime "${String(choice)}".`, "Use \"auto\" (the photo-only lite runtime when the scene is a single 3D photo) or \"full\".");
|
|
824
|
+
const eligibility = liteRuntimeEligibility(source);
|
|
825
|
+
const hasLite = !!opts.runtime?.files?.[LITE_RUNTIME_FILE];
|
|
826
|
+
const runtimeReasons = choice === "full" ? ["runtime: full was requested"] : !eligibility.ok ? eligibility.reasons : !hasLite ? [`the runtime files have no ${LITE_RUNTIME_FILE} (rebuild the runtime: npm run build:runtime)`] : void 0;
|
|
827
|
+
const lite = !runtimeReasons;
|
|
828
|
+
const runtimeEntry = lite ? LITE_RUNTIME_FILE : pickRuntime(opts.runtime, format === "single-html" ? "single-html" : "embed");
|
|
759
829
|
const manifest = await readAssetManifest(fs);
|
|
760
830
|
const entries = new Map(manifest.assets.map((a) => [a.path, a]));
|
|
761
831
|
const scene = clone(source);
|
|
@@ -848,7 +918,12 @@ async function buildExport(fs, opts) {
|
|
|
848
918
|
let head;
|
|
849
919
|
if (format === "embed" || format === "zip") {
|
|
850
920
|
const allRuntime = Object.entries(opts.runtime.files).filter(([k]) => !k.endsWith(".single.js"));
|
|
851
|
-
pageRt =
|
|
921
|
+
pageRt = lite ? {
|
|
922
|
+
loaded: [LITE_RUNTIME_FILE],
|
|
923
|
+
skipped: [],
|
|
924
|
+
unknown: [],
|
|
925
|
+
features: {}
|
|
926
|
+
} : pageRuntime(Object.fromEntries(allRuntime.filter(([k]) => k !== LITE_RUNTIME_FILE)), runtimeEntry, scene);
|
|
852
927
|
pruned = !!opts.pruneRuntime && !pageRt.unknown.length;
|
|
853
928
|
if (opts.pruneRuntime && pageRt.unknown.length) outIssues.push({
|
|
854
929
|
severity: "info",
|
|
@@ -899,7 +974,8 @@ async function buildExport(fs, opts) {
|
|
|
899
974
|
src: url(posterRel) + posterQ,
|
|
900
975
|
avif: opts.posterAvif ? url(`${name}/poster.avif`) + posterQ : void 0,
|
|
901
976
|
alt: label,
|
|
902
|
-
size: opts.posterSize
|
|
977
|
+
size: opts.posterSize,
|
|
978
|
+
priority: kind === "hero" || kind === "fullscreen"
|
|
903
979
|
}) : "";
|
|
904
980
|
snippet = [
|
|
905
981
|
...preloads,
|
|
@@ -1030,6 +1106,8 @@ async function buildExport(fs, opts) {
|
|
|
1030
1106
|
},
|
|
1031
1107
|
credits,
|
|
1032
1108
|
issues: outIssues,
|
|
1109
|
+
runtime: lite ? "photo-lite" : "full",
|
|
1110
|
+
...runtimeReasons ? { runtimeReasons } : {},
|
|
1033
1111
|
...runtimeDirName ? { runtimeDir: runtimeDirName } : {},
|
|
1034
1112
|
...integrity ? { integrity } : {},
|
|
1035
1113
|
...head ? { head } : {}
|
|
@@ -8,7 +8,7 @@ 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.
|
|
11
|
+
var version = "0.4.0";
|
|
12
12
|
var package_default = {
|
|
13
13
|
name,
|
|
14
14
|
version,
|
|
@@ -33,7 +33,7 @@ var package_default = {
|
|
|
33
33
|
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.agent.json",
|
|
34
34
|
"test": "vitest run",
|
|
35
35
|
"test:watch": "vitest",
|
|
36
|
-
"build:runtime": "vite build --config vite.runtime.config.ts && vite build --config vite.runtime.config.ts --mode single",
|
|
36
|
+
"build:runtime": "vite build --config vite.runtime.config.ts && vite build --config vite.runtime.config.ts --mode single && vite build --config vite.runtime.config.ts --mode photo",
|
|
37
37
|
"build:studio": "vite build",
|
|
38
38
|
"build:agent": "vite build --config vite.agent.config.ts",
|
|
39
39
|
"build": "npm run build:runtime && npm run build:studio && npm run build:agent && node scripts/write-version.mjs",
|
|
@@ -8,8 +8,8 @@ import { A as OpsError, C as CATALOG, _ as validateScene, a as listTemplates, d
|
|
|
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-YBkgdfgy.mjs";
|
|
10
10
|
import { r as modelFileBounds } from "./gltf-f_f0-OiV.mjs";
|
|
11
|
-
import { a as estimateDepth, n as checkDepthRequest } from "./depth-
|
|
12
|
-
import { r as prefixFiles, t as buildExport } from "./export-
|
|
11
|
+
import { a as estimateDepth, n as checkDepthRequest } from "./depth-BZT4gseQ.mjs";
|
|
12
|
+
import { r as prefixFiles, t as buildExport } from "./export-CEX5DFLo.mjs";
|
|
13
13
|
import { i as getAt, t as PathError } from "./jsonPath-DUCe1JpS.mjs";
|
|
14
14
|
import { n as checkProject } from "./check-DP9fRYbK.mjs";
|
|
15
15
|
import { a as updateObject, i as removeObject, n as listObjects, t as addObject } from "./objects-DuytRxiC.mjs";
|
|
@@ -1021,7 +1021,7 @@ var ASSET_TOOLS = [
|
|
|
1021
1021
|
},
|
|
1022
1022
|
{
|
|
1023
1023
|
name: "image_depth",
|
|
1024
|
-
description: "Estimate a depth map for a photo (the \"3D photo\" effect: a photo object with `depth`). Runs Depth Anything V2 Small locally (CLI / MCP host: headless Chrome, ~1-3 s per image; the 27 MB Apache-2.0 model is downloaded once into the user cache, later runs work offline). Writes a grey PNG (white = near, transparent where depth jumps) at the photo size (max
|
|
1024
|
+
description: "Estimate a depth map for a photo (the \"3D photo\" effect: a photo object with `depth`). Runs Depth Anything V2 Small locally (CLI / MCP host: headless Chrome, ~1-3 s per image; the 27 MB Apache-2.0 model is downloaded once into the user cache, later runs work offline). Writes a grey PNG (white = near, transparent where depth jumps) at the photo size (max 1024 px) under assets/depth/, registered in assets/manifest.json with the photo's licence. Returns { path, width, height, ms, model, suggestion: { kind: \"photo\", src, depth } } — then add or update the photo object with `depth: path`. Without a host that can run it, paint a depth map by hand instead.",
|
|
1025
1025
|
inputSchema: {
|
|
1026
1026
|
type: "object",
|
|
1027
1027
|
properties: {
|
|
@@ -1043,7 +1043,7 @@ var ASSET_TOOLS = [
|
|
|
1043
1043
|
type: "integer",
|
|
1044
1044
|
minimum: 16,
|
|
1045
1045
|
maximum: 8192,
|
|
1046
|
-
description: "Longest side of the written depth map (default: the photo size, capped at
|
|
1046
|
+
description: "Longest side of the written depth map (default: the photo size, capped at 1024)."
|
|
1047
1047
|
}
|
|
1048
1048
|
},
|
|
1049
1049
|
required: ["image"]
|
|
@@ -1073,7 +1073,7 @@ var ASSET_TOOLS = [
|
|
|
1073
1073
|
},
|
|
1074
1074
|
{
|
|
1075
1075
|
name: "export",
|
|
1076
|
-
description: "Build the self-contained embed and write it into the project (default dist/<format>/). \"embed\": a folder for any static site — agent3d-runtime/ (shared), <name>/scene.json + assets + scripts, index.html (demo page), snippet.html (paste into the page), EMBED.md and frameworks/ (React / Vue / Svelte wrappers). \"zip\": the same folder as one <name>-embed.zip. \"single-html\": one <name>.html with everything inline. Library assets are copied; nothing is hotlinked. Options: `baseUrl` (where the folder is served, so the snippet works from any page), `cacheBust` (versioned runtime folder + ?v= hash for long-term caching), `integrity` (SRI hash on the runtime script, default true), `optimize` (export lighter copies of the assets — the project is not modified), `og` (render a 1200×630 og-image.png social preview). Run check first; returns the snippet, sizes and budget warnings. When the host can render (CLI / MCP / Studio with Chrome): \"poster\" writes a still image (dist/poster.webp; `time`, `image`), \"video\" an MP4 / WebM (dist/video.webm; `codec`, `duration`, `fps`, `size`), \"gif\" / \"animated-webp\" an animated image (dist/animation.gif / .webp), returning { path } — `quality` supersamples, `transparent` keeps the alpha (poster, gif, animated-webp).",
|
|
1076
|
+
description: "Build the self-contained embed and write it into the project (default dist/<format>/). \"embed\": a folder for any static site — agent3d-runtime/ (shared), <name>/scene.json + assets + scripts, index.html (demo page), snippet.html (paste into the page), EMBED.md and frameworks/ (React / Vue / Svelte wrappers). \"zip\": the same folder as one <name>-embed.zip. \"single-html\": one <name>.html with everything inline. Library assets are copied; nothing is hotlinked. Options: `baseUrl` (where the folder is served, so the snippet works from any page), `cacheBust` (versioned runtime folder + ?v= hash for long-term caching), `integrity` (SRI hash on the runtime script, default true), `optimize` (export lighter copies of the assets — the project is not modified), `og` (render a 1200×630 og-image.png social preview), `runtime` (\"auto\" default: a scene that is a single 3D photo ships the photo-only lite runtime agent3d-photo.js, ~14 KB gzipped instead of ~210 KB; \"full\" forces agent3d-runtime.js — the result says which in `runtime`, with `runtimeReasons` when full). Run check first; returns the snippet, sizes and budget warnings. When the host can render (CLI / MCP / Studio with Chrome): \"poster\" writes a still image (dist/poster.webp; `time`, `image`), \"video\" an MP4 / WebM (dist/video.webm; `codec`, `duration`, `fps`, `size`), \"gif\" / \"animated-webp\" an animated image (dist/animation.gif / .webp), returning { path } — `quality` supersamples, `transparent` keeps the alpha (poster, gif, animated-webp).",
|
|
1077
1077
|
inputSchema: {
|
|
1078
1078
|
type: "object",
|
|
1079
1079
|
properties: {
|
|
@@ -1126,6 +1126,11 @@ var ASSET_TOOLS = [
|
|
|
1126
1126
|
type: "boolean",
|
|
1127
1127
|
description: "embed / zip: render a 1200×630 og-image.png social preview (needs a host that can render; default false)."
|
|
1128
1128
|
},
|
|
1129
|
+
runtime: {
|
|
1130
|
+
type: "string",
|
|
1131
|
+
enum: ["auto", "full"],
|
|
1132
|
+
description: "embed / zip / single-html: \"auto\" (default) ships the photo-only lite runtime (agent3d-photo.js, no three.js) when the scene is a single 3D photo, \"full\" always the full runtime."
|
|
1133
|
+
},
|
|
1129
1134
|
out: {
|
|
1130
1135
|
type: "string",
|
|
1131
1136
|
description: "poster / video / gif / animated-webp: project-relative output file under dist/ or renders/ (default \"dist/poster.webp\", \"dist/video.webm\" (.mp4 with codec mp4), \"dist/animation.gif\", \"dist/animation.webp\")."
|
|
@@ -1195,6 +1200,8 @@ var ASSET_TOOLS = [
|
|
|
1195
1200
|
if (!outDir.startsWith("dist/") && outDir !== "dist") throw new OpsError("invalid", `outDir must be under dist/ (got "${outDir}").`, "Use e.g. \"dist/embed\".");
|
|
1196
1201
|
const wantsOg = input.og === true && format !== "single-html";
|
|
1197
1202
|
if (wantsOg && !ctx.host.media) throw new OpsError("invalid", "This host cannot render the og image.", "Export without og, or with the CLI: agent3d export (renders the poster and og-image.png with Chrome).");
|
|
1203
|
+
const runtimeChoice = optStr(input, "runtime") ?? "auto";
|
|
1204
|
+
if (runtimeChoice !== "auto" && runtimeChoice !== "full") throw new OpsError("invalid", `Unknown runtime "${runtimeChoice}".`, "Use \"auto\" (default: the photo-only lite runtime for single-3D-photo scenes) or \"full\".");
|
|
1198
1205
|
const runtime = { files: await ctx.host.runtimeFiles(format) };
|
|
1199
1206
|
let library = ctx.host.library ?? {
|
|
1200
1207
|
index: { assets: [] },
|
|
@@ -1213,7 +1220,8 @@ var ASSET_TOOLS = [
|
|
|
1213
1220
|
baseUrl: optStr(input, "baseUrl"),
|
|
1214
1221
|
cacheBust: input.cacheBust === true,
|
|
1215
1222
|
integrity: input.integrity !== false,
|
|
1216
|
-
extras: input.extras !== false
|
|
1223
|
+
extras: input.extras !== false,
|
|
1224
|
+
runtimeChoice
|
|
1217
1225
|
});
|
|
1218
1226
|
let optimized;
|
|
1219
1227
|
let r;
|
|
@@ -1244,6 +1252,8 @@ var ASSET_TOOLS = [
|
|
|
1244
1252
|
skippedChunks: r.page.skippedChunks.length,
|
|
1245
1253
|
...r.page.pruned ? { pruned: true } : {}
|
|
1246
1254
|
},
|
|
1255
|
+
runtime: r.runtime,
|
|
1256
|
+
...r.runtimeReasons ? { runtimeReasons: r.runtimeReasons } : {},
|
|
1247
1257
|
snippet: format === "single-html" ? `(single file) ${outDir}/${r.entry}` : r.snippet,
|
|
1248
1258
|
...r.head ? { head: r.head } : {},
|
|
1249
1259
|
...r.runtimeDir ? { runtimeDir: r.runtimeDir } : {},
|