@displayxr/inline3d-tools 0.1.0 → 0.1.1

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/AGENTS.md CHANGED
@@ -15,11 +15,11 @@ sandboxed agent, prefer the MCP server** (below): MCP servers run outside the sa
15
15
  sandbox. Otherwise run them as shell commands:
16
16
 
17
17
  ```sh
18
- npx -y @displayxr/inline3d-tools@0.1.0 check <url | dir | page.html> [--root <project>] [--max-texture 4096]
19
- npx -y @displayxr/inline3d-tools@0.1.0 assets <file.glb> [--target tablet|desktop]
20
- npx -y @displayxr/inline3d-tools@0.1.0 assets prep <in> <out.glb> [--metres 0.01] [--decimate 0.5]
21
- npx -y @displayxr/inline3d-tools@0.1.0 scaffold <esm|vite> <target-dir> --title "<page title>"
22
- npx -y @displayxr/inline3d-tools@0.1.0 gen providers | gen run <adapter> ... --confirm-paid | gen provenance --file ...
18
+ npx -y @displayxr/inline3d-tools@0.1.1 check <url | dir | page.html> [--root <project>] [--max-texture 4096]
19
+ npx -y @displayxr/inline3d-tools@0.1.1 assets <file.glb> [--target tablet|desktop]
20
+ npx -y @displayxr/inline3d-tools@0.1.1 assets prep <in> <out.glb> [--metres 0.01] [--decimate 0.5]
21
+ npx -y @displayxr/inline3d-tools@0.1.1 scaffold <esm|vite> <target-dir> --title "<page title>"
22
+ npx -y @displayxr/inline3d-tools@0.1.1 gen providers | gen run <adapter> ... --confirm-paid | gen provenance --file ...
23
23
  ```
24
24
 
25
25
  or, with the MCP server configured (`inline3d-tools mcp`; config snippets for Codex, Cursor and
@@ -152,7 +152,7 @@ range), `three` **0.180.0**. CDN import maps pin the same: `https://cdn.jsdelivr
152
152
  ### 7. Before you say done: run the checker
153
153
 
154
154
  ```sh
155
- npx -y @displayxr/inline3d-tools@0.1.0 check <url | dir | page.html> [--root <project>] [--max-texture 4096]
155
+ npx -y @displayxr/inline3d-tools@0.1.1 check <url | dir | page.html> [--root <project>] [--max-texture 4096]
156
156
  ```
157
157
 
158
158
  This runs the exact-pinned `@displayxr/inline3d-tools` package from npm (the first run downloads it;
@@ -180,8 +180,8 @@ The templates ship in the exact-pinned `@displayxr/inline3d-tools` npm package;
180
180
  command copies them (the first run downloads the package; the user may be asked to approve the command):
181
181
 
182
182
  ```sh
183
- npx -y @displayxr/inline3d-tools@0.1.0 scaffold esm <target-dir> --title "<page title>"
184
- npx -y @displayxr/inline3d-tools@0.1.0 scaffold vite <target-dir> --title "<page title>" [--name <npm-name>]
183
+ npx -y @displayxr/inline3d-tools@0.1.1 scaffold esm <target-dir> --title "<page title>"
184
+ npx -y @displayxr/inline3d-tools@0.1.1 scaffold vite <target-dir> --title "<page title>" [--name <npm-name>]
185
185
  ```
186
186
 
187
187
  It never overwrites an existing file (`--force` replaces). What it writes:
@@ -229,8 +229,8 @@ It never overwrites an existing file (`--force` replaces). What it writes:
229
229
  5. **Run the checker before saying done**, and fix every FAIL:
230
230
 
231
231
  ```sh
232
- npx -y @displayxr/inline3d-tools@0.1.0 check <target-dir> # esm
233
- npx -y @displayxr/inline3d-tools@0.1.0 check http://localhost:5173/ # vite dev server
232
+ npx -y @displayxr/inline3d-tools@0.1.1 check <target-dir> # esm
233
+ npx -y @displayxr/inline3d-tools@0.1.1 check http://localhost:5173/ # vite dev server
234
234
  ```
235
235
 
236
236
  The untouched template passes every check (verdict PASS). If your change makes a check fail, the
@@ -247,17 +247,17 @@ Tools, in the order to reach for them:
247
247
 
248
248
  | Tool | When | Install |
249
249
  |---|---|---|
250
- | `inline3d-tools assets` | always, last | `npx -y @displayxr/inline3d-tools@0.1.0 assets` (exact pin, from npm; Node only) |
250
+ | `inline3d-tools assets` | always, last | `npx -y @displayxr/inline3d-tools@0.1.1 assets` (exact pin, from npm; Node only) |
251
251
  | glTF-Transform CLI | glTF/GLB in, glTF/GLB out: inspect, resize, compress, simplify, centre | `npx -y @gltf-transform/cli@4.3.0` (pinned; nothing installed globally) |
252
252
  | Blender (headless) | any other format (FBX, OBJ, STL, PLY, DAE, .blend), units/axis fixes, heavy decimation | **only if already installed**; never install it |
253
- | `inline3d-tools gen` | no asset exists and the user wants one generated | `npx -y @displayxr/inline3d-tools@0.1.0 gen`; needs the user's own API key in the environment; every call is paid and needs the user's yes |
253
+ | `inline3d-tools gen` | no asset exists and the user wants one generated | `npx -y @displayxr/inline3d-tools@0.1.1 gen`; needs the user's own API key in the environment; every call is paid and needs the user's yes |
254
254
 
255
255
  ### 1. Get it
256
256
 
257
257
  In order of preference:
258
258
 
259
259
  1. **The user's own asset** (in the project, or a path they gave). Record it:
260
- `npx -y @displayxr/inline3d-tools@0.1.0 gen provenance --file assets/x.glb --source "supplied by the user" --license "user's"`.
260
+ `npx -y @displayxr/inline3d-tools@0.1.1 gen provenance --file assets/x.glb --source "supplied by the user" --license "user's"`.
261
261
  2. **A library asset with a clear licence** (CC0 / CC-BY, e.g. the Khronos glTF sample models,
262
262
  Poly Haven). Record the URL, author and licence; CC-BY needs visible credit on the page.
263
263
  3. **A placeholder you build** (primitives in three.js/PlayCanvas) when nothing fits and the user
@@ -287,7 +287,7 @@ fetches decoders from a CDN). Other fixes: `$GT simplify in.glb out.glb --ratio
287
287
  **Anything else (Blender, if present).** Detect it, don't install it:
288
288
 
289
289
  ```sh
290
- npx -y @displayxr/inline3d-tools@0.1.0 assets prep in.fbx out.glb [--metres 0.01] [--decimate 0.5] [--blender <path>]
290
+ npx -y @displayxr/inline3d-tools@0.1.1 assets prep in.fbx out.glb [--metres 0.01] [--decimate 0.5] [--blender <path>]
291
291
  ```
292
292
 
293
293
  It looks for Blender (`--blender`, `$BLENDER`, `PATH`, the default install location), never installs
@@ -303,8 +303,8 @@ helmet is ~0.3 m, not 2 m).
303
303
  ### 3. Check it (before the page uses it)
304
304
 
305
305
  ```sh
306
- npx -y @displayxr/inline3d-tools@0.1.0 assets out.glb # tablet budget (default)
307
- npx -y @displayxr/inline3d-tools@0.1.0 assets out.glb --target desktop
306
+ npx -y @displayxr/inline3d-tools@0.1.1 assets out.glb # tablet budget (default)
307
+ npx -y @displayxr/inline3d-tools@0.1.1 assets out.glb --target desktop
308
308
  ```
309
309
 
310
310
  It reports: missing external files, decoders the page must provide, triangles (both eyes draw
@@ -318,7 +318,7 @@ animations. Fix every FAIL; act on WARNs or say why not. Then run the page check
318
318
  ### 4. Generate it (optional, paid, the user's keys)
319
319
 
320
320
  ```sh
321
- npx -y @displayxr/inline3d-tools@0.1.0 gen providers # which adapters have a key (names only)
321
+ npx -y @displayxr/inline3d-tools@0.1.1 gen providers # which adapters have a key (names only)
322
322
  ```
323
323
 
324
324
  Adapters: `meshy` and `tripo` (text-to-3d, image-to-3d → GLB), `openai` (image → PNG, for
@@ -339,7 +339,7 @@ textures, posters and backdrops). Each reads its key from the environment (`MESH
339
339
  shippable.
340
340
 
341
341
  ```sh
342
- npx -y @displayxr/inline3d-tools@0.1.0 gen run meshy --kind text-to-3d --prompt "a brass desk lamp, PBR" --out assets/lamp-raw.glb --confirm-paid
342
+ npx -y @displayxr/inline3d-tools@0.1.1 gen run meshy --kind text-to-3d --prompt "a brass desk lamp, PBR" --out assets/lamp-raw.glb --confirm-paid
343
343
  ```
344
344
 
345
345
  ### 5. ASSETS.md
package/README.md CHANGED
@@ -9,7 +9,7 @@ same operations. [`AGENTS.md`](AGENTS.md) is the matching authoring checklist fo
9
9
  Needs Node ≥ 18. `check` also needs a local Chrome or Chromium. Always run an **exact version**:
10
10
 
11
11
  ```sh
12
- npx -y @displayxr/inline3d-tools@0.1.0 <command> ...
12
+ npx -y @displayxr/inline3d-tools@0.1.1 <command> ...
13
13
  ```
14
14
 
15
15
  ## CLI
@@ -47,7 +47,7 @@ environment only and are redacted from every tool result.
47
47
  ### Claude Code
48
48
 
49
49
  ```sh
50
- claude mcp add inline3d-tools -- npx -y @displayxr/inline3d-tools@0.1.0 mcp
50
+ claude mcp add inline3d-tools -- npx -y @displayxr/inline3d-tools@0.1.1 mcp
51
51
  ```
52
52
 
53
53
  or in a project's `.mcp.json`:
@@ -57,7 +57,7 @@ or in a project's `.mcp.json`:
57
57
  "mcpServers": {
58
58
  "inline3d-tools": {
59
59
  "command": "npx",
60
- "args": ["-y", "@displayxr/inline3d-tools@0.1.0", "mcp"]
60
+ "args": ["-y", "@displayxr/inline3d-tools@0.1.1", "mcp"]
61
61
  }
62
62
  }
63
63
  }
@@ -77,7 +77,7 @@ needs you to approve running it outside the sandbox. In `~/.codex/config.toml` (
77
77
  ```toml
78
78
  [mcp_servers.inline3d-tools]
79
79
  command = "npx"
80
- args = ["-y", "@displayxr/inline3d-tools@0.1.0", "mcp"]
80
+ args = ["-y", "@displayxr/inline3d-tools@0.1.1", "mcp"]
81
81
  # cwd = "/path/to/your/project" # relative paths in tool calls resolve here
82
82
  startup_timeout_sec = 30 # first run downloads the package (default 10)
83
83
  tool_timeout_sec = 180 # a page check takes 10-60 s; generation can take minutes (default 60)
@@ -85,7 +85,18 @@ tool_timeout_sec = 180 # a page check takes 10-60 s; generation can t
85
85
  # env_vars = ["MESHY_API_KEY", "TRIPO_API_KEY", "OPENAI_API_KEY"]
86
86
  ```
87
87
 
88
- or `codex mcp add inline3d-tools -- npx -y @displayxr/inline3d-tools@0.1.0 mcp`. Codex reads
88
+ or `codex mcp add inline3d-tools -- npx -y @displayxr/inline3d-tools@0.1.1 mcp`. The
89
+ [`displayxr-inline3d-codex` plugin](https://github.com/DisplayXR/displayxr-web/tree/main/plugins/displayxr-inline3d-codex)
90
+ sets the server up for you in Codex.
91
+
92
+ **Fetch the package once before the first Codex session:** `npx -y @displayxr/inline3d-tools@0.1.1 --version`.
93
+ Codex starts MCP servers when a session starts and can stop one before a cold `npx` download
94
+ finishes. The interrupted download leaves a broken entry in npm's `_npx` cache (`node_modules`
95
+ without a `package.json`), and from then on the server fails at every start with
96
+ `npm error enoent Could not read package.json` in Codex's log. To recover, delete the
97
+ `~/.npm/_npx/<hash>` directory named in that error, then run the command above.
98
+
99
+ Codex reads
89
100
  [`AGENTS.md`](AGENTS.md) files from the project: copy this package's into yours (or call the
90
101
  `authoring_guide` tool).
91
102
 
@@ -98,7 +109,7 @@ In `~/.cursor/mcp.json` (all projects) or `.cursor/mcp.json` (one project):
98
109
  "mcpServers": {
99
110
  "inline3d-tools": {
100
111
  "command": "npx",
101
- "args": ["-y", "@displayxr/inline3d-tools@0.1.0", "mcp"]
112
+ "args": ["-y", "@displayxr/inline3d-tools@0.1.1", "mcp"]
102
113
  }
103
114
  }
104
115
  }
@@ -140,12 +151,13 @@ forwarding). Never paste a key into an agent chat.
140
151
  ## check
141
152
 
142
153
  ```sh
143
- npx -y @displayxr/inline3d-tools@0.1.0 check <url | dir | page.html> [--root <dir>] [--max-texture 4096] [--json] [--out report.json]
154
+ npx -y @displayxr/inline3d-tools@0.1.1 check <url | dir | page.html> [--root <dir>] [--max-texture 4096] [--json] [--out report.json]
144
155
  ```
145
156
 
146
157
  Needs Node ≥ 18 and a local Chrome (`CHROME=/path/to/chrome` overrides the default location). It
147
158
  speaks the DevTools protocol over a pipe, so it opens no port, and it closes the
148
- Chrome it started. Exit code 0 = pass (warnings allowed), 1 = a check failed, 2 = the checker could
159
+ Chrome it started. If Chrome does not answer on that pipe within 15 s (a cold start on a busy
160
+ machine), the checker retries once with a fresh profile before giving up (0.1.1). Exit code 0 = pass (warnings allowed), 1 = a check failed, 2 = the checker could
149
161
  not run.
150
162
 
151
163
  The fake environment gives the SDK what the DisplayXR Browser gives it (`navigator.xr`
package/lib/check/cdp.mjs CHANGED
@@ -29,10 +29,30 @@ export function findChrome() {
29
29
  return null;
30
30
  }
31
31
 
32
- export async function launchChrome({ chrome = findChrome(), extraArgs = [], width = 1280, height = 800 } = {}) {
32
+ const PIPE_TIMEOUT = 'Chrome did not answer on the DevTools pipe';
33
+
34
+ // A cold Chrome start (first launch after an update, a busy box, a slow disk) occasionally misses
35
+ // the first DevTools round trip even though a second launch is fine (#299). So a launch that fails
36
+ // only on that handshake is retried once with a fresh profile; any other failure, and a second
37
+ // handshake miss, is reported as is.
38
+ export async function launchChrome(opts = {}) {
39
+ const { chrome = findChrome(), pipeTimeoutMs = 15000, attempts = 2 } = opts;
33
40
  if (!chrome || !existsSync(chrome)) {
34
41
  throw new Error(`Chrome not found${chrome ? ` at ${chrome}` : ''}. Set CHROME=/path/to/chrome.`);
35
42
  }
43
+ for (let i = 1; ; i++) {
44
+ try {
45
+ return await launchOnce({ ...opts, chrome, pipeTimeoutMs });
46
+ } catch (e) {
47
+ if (i >= attempts || !String(e.message).includes(PIPE_TIMEOUT)) {
48
+ if (i > 1) e.message = `${e.message} (after ${i} attempts)`;
49
+ throw e;
50
+ }
51
+ }
52
+ }
53
+ }
54
+
55
+ async function launchOnce({ chrome, extraArgs = [], width = 1280, height = 800, pipeTimeoutMs }) {
36
56
  const profile = mkdtempSync(join(tmpdir(), 'inline3d-check-'));
37
57
  const args = [
38
58
  '--headless=new',
@@ -59,6 +79,10 @@ export async function launchChrome({ chrome = findChrome(), extraArgs = [], widt
59
79
  'about:blank',
60
80
  ];
61
81
  const proc = spawn(chrome, args, { stdio: ['ignore', 'ignore', 'pipe', 'pipe', 'pipe'] });
82
+ // Killing Chrome resets its pipes; on Linux that surfaces as ECONNRESET on these streams, which
83
+ // with no listener is an uncaught exception that takes the whole process down. Exit is handled
84
+ // below, so the stream errors themselves carry nothing.
85
+ for (const s of [proc.stdio[2], proc.stdio[3], proc.stdio[4]]) s?.on('error', () => {});
62
86
  let stderr = '';
63
87
  proc.stderr.on('data', (d) => {
64
88
  stderr = (stderr + d.toString()).slice(-4000);
@@ -71,7 +95,7 @@ export async function launchChrome({ chrome = findChrome(), extraArgs = [], widt
71
95
 
72
96
  // First round trip proves the pipe is up.
73
97
  try {
74
- await withTimeout(conn.send('Browser.getVersion'), 15000, 'Chrome did not answer on the DevTools pipe');
98
+ await withTimeout(conn.send('Browser.getVersion'), pipeTimeoutMs, PIPE_TIMEOUT);
75
99
  } catch (e) {
76
100
  try { process.kill(proc.pid, 'SIGKILL'); } catch { /* gone */ }
77
101
  try { rmSync(profile, { recursive: true, force: true }); } catch { /* best effort */ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@displayxr/inline3d-tools",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Agent-agnostic tools for @displayxr/inline3d pages: a headless checker (fake DisplayXR Browser + plain 2D run), a glTF/GLB asset check, page scaffolds, optional asset generation with provenance, and a stdio MCP server exposing the same operations.",
5
5
  "type": "module",
6
6
  "bin": {