Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(avatar-cli): keep the embedded live viewer inside its frame on narrow screens

nirholasc0387fe82999
diff --git a/docs/avatar-cli.md b/docs/avatar-cli.md
index aac57762d..32bc815c7 100644
--- a/docs/avatar-cli.md
+++ b/docs/avatar-cli.md
@@ -20,7 +20,7 @@ three-ws-avatar --version
```
```
-0.2.0
+0.2.1
```
Or run it without installing. The package has exactly one binary, so `npx` resolves it directly:
@@ -32,7 +32,7 @@ npx @three-ws/avatar-cli --version
Pin the version in anything automated so a future release cannot change your build's behavior:
```bash
-npx @three-ws/[email protected] validate manifest.json
+npx @three-ws/[email protected] validate manifest.json
```
Node 18 or newer. The CLI has one runtime dependency, `@three-ws/avatar-schema`, which carries the JSON Schema it validates against.
diff --git a/pages/avatar-cli.html b/pages/avatar-cli.html
index 3ebf027bb..abed4356f 100644
--- a/pages/avatar-cli.html
+++ b/pages/avatar-cli.html
@@ -44,7 +44,7 @@
<link rel="stylesheet" href="/avatar-cli.css" />
<script defer src="/footer-newsletter.js"></script>
- <script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"WebPage","name":"Avatar CLI","description":"Terminal-native tooling for on-chain avatars: scaffold, validate, hash, and preview avatar manifests from your shell.","url":"https://three.ws/avatar-cli","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"}},{"@type":"SoftwareApplication","name":"@three-ws/avatar-cli","applicationCategory":"DeveloperApplication","operatingSystem":"Linux, macOS, Windows","offers":{"@type":"Offer","price":"0","priceCurrency":"USD"},"softwareVersion":"0.2.0","url":"https://www.npmjs.com/package/@three-ws/avatar-cli"}]}</script>
+ <script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"WebPage","name":"Avatar CLI","description":"Terminal-native tooling for on-chain avatars: scaffold, validate, hash, and preview avatar manifests from your shell.","url":"https://three.ws/avatar-cli","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"}},{"@type":"SoftwareApplication","name":"@three-ws/avatar-cli","applicationCategory":"DeveloperApplication","operatingSystem":"Linux, macOS, Windows","offers":{"@type":"Offer","price":"0","priceCurrency":"USD"},"softwareVersion":"0.2.1","url":"https://www.npmjs.com/package/@three-ws/avatar-cli"}]}</script>
</head>
<body>
<header><div id="nav-container"></div></header>
@@ -66,7 +66,7 @@
</div>
<h1 class="cli-h1" id="cli-hero-title">
- Avatars belong in your<br /><em>build pipeline</em>.
+ Avatars belong in your <br /><em>build pipeline</em>.
</h1>
<p class="cli-sub">
@@ -185,6 +185,8 @@
<pre class="cli-snip"><code>$ three-ws-avatar validate broken.json
<span class="e">✖ broken.json is invalid (7 errors)</span>
• / must have required property 'mesh'
+ • / must have required property 'skeleton'
+<span class="dim"> …</span>
• /id must match a schema in anyOf</code></pre>
</article>
@@ -214,9 +216,9 @@ $ echo "$sha"
<code>mesh.uri</code> is still a local path.
</p>
<pre class="cli-snip"><code>$ three-ws-avatar preview manifest.json
-<span class="dim">› web component</span>
-&lt;script type="module" src="…/agent-3d.js"&gt;&lt;/script&gt;
-&lt;agent-3d src="…/michelle.glb"&gt;&lt;/agent-3d&gt;</code></pre>
+<span class="dim">› web component (loader registers &lt;agent-3d&gt;)</span>
+&lt;script type="module" src="https://three.ws/agent-3d/latest/agent-3d.js"&gt;&lt;/script&gt;
+&lt;agent-3d src="https://three.ws/avatars/michelle.glb" style="width:400px;height:600px"&gt;&lt;/agent-3d&gt;</code></pre>
</article>
</div>
</div>
@@ -244,14 +246,14 @@ $ echo "$sha"
<span class="cli-copy-label">Copy</span>
</button>
</div>
- <pre class="cli-snip cli-snip-lg"><code id="live-snippet">&lt;script type="module" src="/agent-3d/latest/agent-3d.js"&gt;&lt;/script&gt;
-&lt;agent-3d
- src="https://three.ws/avatars/michelle.glb"
- style="width:100%;height:420px"&gt;&lt;/agent-3d&gt;</code></pre>
+ <pre class="cli-snip cli-snip-lg"><code id="live-snippet">&lt;script type="module" src="https://three.ws/agent-3d/latest/agent-3d.js"&gt;&lt;/script&gt;
+&lt;agent-3d src="https://three.ws/avatars/michelle.glb" style="width:400px;height:600px"&gt;&lt;/agent-3d&gt;</code></pre>
<p class="cli-live-note">
Both lines matter. <code>&lt;agent-3d&gt;</code> is an unknown element until the
loader registers it, so pasting only the tag gives you an empty box with no
- warning. That is why <code>preview</code> always prints them together.
+ warning. That is why <code>preview</code> always prints them together. The
+ viewer opposite is this exact markup; only a stylesheet rule caps its width on
+ narrow screens, which the element handles by re-laying out.
</p>
</div>
@@ -267,14 +269,8 @@ $ echo "$sha"
see the <a href="/docs/web-component">web component reference</a>.
</span>
</p>
- <script
- type="module"
- src="https://three.ws/agent-3d/latest/agent-3d.js"
- ></script>
- <agent-3d
- src="https://three.ws/avatars/michelle.glb"
- style="width:100%;height:420px"
- ></agent-3d>
+ <script type="module" src="https://three.ws/agent-3d/latest/agent-3d.js"></script>
+ <agent-3d src="https://three.ws/avatars/michelle.glb" style="width:400px;height:600px"></agent-3d>
</div>
<p class="cli-live-caption">
<code>michelle.glb</code> &middot; Mixamo rig &middot; served from three.ws
diff --git a/public/avatar-cli.css b/public/avatar-cli.css
index bc2a651ee..0c4874e0f 100644
--- a/public/avatar-cli.css
+++ b/public/avatar-cli.css
@@ -608,17 +608,31 @@
margin-top: var(--space-sm);
}
+/* The embedded snippet is the CLI's output verbatim, so its 400x600 box is set
+ inline on the element. The frame only centers it and caps its width on narrow
+ screens; the element's ResizeObserver re-lays-out the canvas to match. */
.cli-live-stage-frame {
position: relative;
+ display: grid;
+ /* minmax(0, 1fr) keeps the column from auto-sizing to the viewer's 400px:
+ an overflowing column would become the percentage basis and defeat the
+ max-width clamp below. */
+ grid-template-columns: minmax(0, 1fr);
+ place-items: center;
border: 1px solid var(--stroke-strong);
border-radius: var(--radius-lg);
background: var(--surface-2);
overflow: hidden;
- min-height: 420px;
+ min-height: 600px;
}
+/* min-width:0 is load-bearing: a grid item's automatic minimum size is its
+ min-content width, which here is the inline 400px and would win over
+ max-width, cropping the viewer below a 400px-wide frame. */
.cli-live-stage-frame agent-3d {
display: block;
+ min-width: 0;
+ max-width: 100%;
opacity: 0;
transition: opacity 420ms ease;
}
diff --git a/src/avatar-cli-page.js b/src/avatar-cli-page.js
index 3578b383a..d52a1c927 100644
--- a/src/avatar-cli-page.js
+++ b/src/avatar-cli-page.js
@@ -5,7 +5,7 @@
* wire the copy buttons, and drive the live viewer through loading → ready or
* failed so the section never sits as an empty rectangle.
*
- * The transcript below is a verbatim capture of the CLI at 0.2.0, not a
+ * The transcript below is a verbatim capture of the CLI at 0.2.1, not a
* dramatization. If the CLI's output changes, this should be recaptured.
*/
@@ -26,14 +26,23 @@ const TRANSCRIPT = [
{ kind: 'out', cls: 'dim', text: ' • id eip155:1:0x742d35Cc6634C0532925a3b844Bc454e4438f44e' },
{ kind: 'out', cls: 'dim', text: ' • skeleton mixamo' },
{ kind: 'out', cls: 'dim', text: ' • mesh glb · 830 kB · sha256:28d788538f7b…' },
+ { kind: 'out', cls: 'dim', text: ' › next: three-ws-avatar preview manifest.json' },
{ kind: 'gap' },
{ kind: 'cmd', text: 'three-ws-avatar validate manifest.json' },
{ kind: 'out', cls: 'ok', text: '✔ manifest.json is valid' },
{ kind: 'gap' },
{ kind: 'cmd', text: 'three-ws-avatar preview manifest.json' },
+ { kind: 'out', cls: 'c', text: 'Nicholas (eip155:1:0x742d35Cc6634C0532925a3b844Bc454e4438f44e)' },
+ { kind: 'gap' },
+ { kind: 'out', cls: 'dim', text: '› resolver url' },
+ { kind: 'out', text: 'https://three.ws/a/eip155%3A1%3A0x742d35Cc6634C0532925a3b844Bc454e4438f44e' },
+ { kind: 'gap' },
{ kind: 'out', cls: 'dim', text: '› web component (loader registers <agent-3d>)' },
- { kind: 'out', text: '<script type="module" src="/agent-3d/latest/agent-3d.js"></script>' },
- { kind: 'out', text: '<agent-3d src="https://three.ws/avatars/michelle.glb"></agent-3d>' },
+ { kind: 'out', text: '<script type="module" src="https://three.ws/agent-3d/latest/agent-3d.js"></script>' },
+ {
+ kind: 'out',
+ text: '<agent-3d src="https://three.ws/avatars/michelle.glb" style="width:400px;height:600px"></agent-3d>',
+ },
];
const escapeHtml = (s) =>