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.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
feat: add five-step /create-agent wizard wired to real agent/marketplace endpoints; worker deploy + config updates
nirholas1df9f7f70d80
diff --git a/data/pages.json b/data/pages.jsonindex 87c9d0112..52b18cd36 100644--- a/data/pages.json+++ b/data/pages.json@@ -111,6 +111,13 @@"priority": 0.9,"changefreq": "weekly"},+ {+ "path": "/create-agent",+ "title": "Create an Agent",+ "description": "Step-by-step wizard to create a 3D AI agent: name, 3D body, skills, personality, voice, and on-chain identity.",+ "priority": 0.9,+ "changefreq": "weekly"+ },{"path": "/app","title": "Viewer",diff --git a/multiplayer/src/rooms/WalkRoom.js b/multiplayer/src/rooms/WalkRoom.jsindex 502e70a48..657f35160 100644--- a/multiplayer/src/rooms/WalkRoom.js+++ b/multiplayer/src/rooms/WalkRoom.js@@ -244,6 +244,7 @@ export class WalkRoom extends Room {this.onMessage('emote', (client, payload) => this._handleEmote(client, payload));this.onMessage('chat', (client, payload) => this._handleChat(client, payload));this.onMessage('avatar', (client, payload) => this._handleAvatar(client, payload));+ this.onMessage('play-pass', (client, payload) => this._handlePlayPassRefresh(client, payload));this.onMessage('place', (client, payload) => this._handlePlace(client, payload));this.onMessage('remove', (client, payload) => this._handleRemove(client, payload));this.onMessage('voice-state', (client, payload) => this._handleVoiceState(client, payload));@@ -727,6 +728,26 @@ export class WalkRoom extends Room {client.send('edit-reject', { reason });}+ // Adopt a mid-session play-pass refresh. The client re-mints a pass (re-reading+ // the chain) ahead of the 10-min TTL and pushes it here so this live session's+ // bound expiry tracks the fresh credential — without this, the once-a-minute+ // expiry sweep evicts a still-qualifying player at the original TTL, which is+ // what kicked anyone in a long building session. We re-verify exactly as onAuth+ // does: a valid pass for this gate's mint, at or above the floor, bound to the+ // same wallet. Anything else is silently ignored — the stale expiry stands and+ // the sweep handles it, so a forged refresh can't extend or hijack a session.+ _handlePlayPassRefresh(client, payload) {+ if (!PLAY_GATE_MINT) return;+ const pass = verifyPlayPass(payload?.playPass);+ if (!pass) return;+ if (pass.mint !== PLAY_GATE_MINT) return;+ if (!(typeof pass.balance === 'number' && pass.balance >= PLAY_GATE_MIN)) return;+ // The refreshed pass must belong to the wallet this session authenticated as,+ // so a leaked pass from another holder can't graft onto this connection.+ if (client.userData?.account && pass.wallet !== client.userData.account) return;+ client.userData = { ...(client.userData || {}), playBalance: pass.balance, playExp: pass.exp };+ }+_handlePlace(client, payload) {if (!this.state.players.has(client.sessionId)) return;if (!this._editOk(client.sessionId)) { this._rejectEdit(client, 'rate'); return; }diff --git a/pages/create-agent.html b/pages/create-agent.htmlnew file mode 100644index 000000000..04ed414c5--- /dev/null+++ b/pages/create-agent.html@@ -0,0 +1,1265 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />+ <title>Create an agent · three.ws</title>+ <meta name="theme-color" content="#000000" />+ <meta name="mobile-web-app-capable" content="yes" />+ <meta name="apple-mobile-web-app-capable" content="yes" />+ <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />+ <meta name="apple-mobile-web-app-title" content="three.ws" />+ <link rel="apple-touch-icon" href="/pwa-192x192.png" />+ <link rel="icon" href="/favicon.ico" />+ <meta+ name="description"+ content="Create a 3D AI agent step by step — name it, give it a body, pick its skills, set its personality, and ship it on-chain."+ />+ <meta name="robots" content="noindex" />++ <meta property="og:type" content="website" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:url" content="https://three.ws/create-agent" />+ <meta property="og:title" content="Create an agent · three.ws" />+ <meta+ property="og:description"+ content="Create a 3D AI agent step by step — name it, give it a body, pick its skills, set its personality, and ship it on-chain."+ />+ <meta property="og:image" content="https://three.ws/og-image.png" />+ <meta property="og:image:width" content="1200" />+ <meta property="og:image:height" content="630" />+ <meta name="twitter:card" content="summary_large_image" />+ <meta name="twitter:title" content="Create an agent · three.ws" />+ <meta+ name="twitter:description"+ content="Create a 3D AI agent step by step — name it, give it a body, pick its skills, set its personality, and ship it on-chain."+ />+ <meta name="twitter:image" content="https://three.ws/og-image.png" />++ <link rel="stylesheet" href="/nav.css" />+ <link rel="stylesheet" href="/footer.css" />+ <link rel="stylesheet" href="/mobile.css" />+ <link rel="stylesheet" href="/buttons.css" />+ <script defer src="/footer-newsletter.js"></script>++ <style>+ :root {+ color-scheme: dark;+ --accent: #ffffff;+ --accent-ink: #000000;+ --bg: #000000;+ --panel: #0a0a0a;+ --panel-2: #101010;+ --border: #1a1a1a;+ --border-strong: #2a2a2a;+ --text: #e8e8e8;+ --muted: #888888;+ --faint: rgba(255, 255, 255, 0.45);+ --ok: #4ade80;+ --err: #f87171;+ --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;+ --header-h: 3.5rem;+ }+ * {+ box-sizing: border-box;+ }+ html,+ body {+ margin: 0;+ padding: 0;+ }+ body {+ font:+ 15px/1.55 -apple-system,+ system-ui,+ 'Segoe UI',+ Roboto,+ sans-serif;+ color: var(--text);+ background: var(--bg);+ min-height: 100vh;+ overflow-x: hidden;+ }+ body::before {+ content: '';+ position: fixed;+ inset: 0;+ z-index: -1;+ pointer-events: none;+ background:+ radial-gradient(820px 520px at 50% -120px, rgba(255, 255, 255, 0.035) 0, transparent 70%),+ #000;+ }+ .skip-link {+ position: absolute;+ left: -9999px;+ }+ .skip-link:focus {+ left: 1rem;+ top: 1rem;+ padding: 0.5rem 1rem;+ background: var(--panel);+ border: 1px solid var(--border);+ border-radius: 8px;+ z-index: 9999;+ }++ /* ── Page loading veil ──────────────────────────────────────────── */+ #page-loading {+ position: fixed;+ inset: 0;+ z-index: 9999;+ background: #000;+ display: flex;+ flex-direction: column;+ align-items: center;+ justify-content: center;+ gap: 18px;+ }+ #page-loading img {+ width: 56px;+ height: 56px;+ animation: pulse 1.6s ease-in-out infinite;+ }+ #page-loading .dots {+ color: rgba(255, 255, 255, 0.6);+ font-size: 22px;+ letter-spacing: 4px;+ }+ @keyframes pulse {+ 0%,+ 100% {+ opacity: 0.55;+ transform: scale(1);+ }+ 50% {+ opacity: 1;+ transform: scale(1.06);+ }+ }++ /* ── Layout ─────────────────────────────────────────────────────── */+ main.stage {+ max-width: 840px;+ margin: 0 auto;+ padding: 44px 24px 96px;+ }+ .wizard-head {+ text-align: center;+ max-width: 600px;+ margin: 0 auto 28px;+ }+ .wizard-title {+ font-family: var(--font-display);+ font-size: clamp(26px, 4.6vw, 36px);+ font-weight: 600;+ margin: 0 0 10px;+ letter-spacing: -0.025em;+ line-height: 1.1;+ background: linear-gradient(180deg, #fff 0%, #b8b8b8 100%);+ -webkit-background-clip: text;+ background-clip: text;+ -webkit-text-fill-color: transparent;+ }+ .wizard-sub {+ color: var(--muted);+ font-size: 14.5px;+ margin: 0;+ }++ /* ── Stepper ────────────────────────────────────────────────────── */+ .stepper {+ display: flex;+ align-items: center;+ justify-content: center;+ gap: 0;+ margin: 0 auto 30px;+ max-width: 720px;+ list-style: none;+ padding: 0;+ flex-wrap: wrap;+ }+ .step-pip {+ display: flex;+ align-items: center;+ gap: 9px;+ color: var(--muted);+ font-size: 12.5px;+ font-weight: 500;+ white-space: nowrap;+ }+ .step-pip .num {+ width: 26px;+ height: 26px;+ border-radius: 50%;+ display: grid;+ place-items: center;+ border: 1.5px solid var(--border-strong);+ background: var(--panel);+ font-size: 12px;+ font-weight: 600;+ color: var(--muted);+ transition:+ background 0.2s,+ border-color 0.2s,+ color 0.2s,+ transform 0.2s;+ flex: 0 0 auto;+ }+ .step-pip[data-state='active'] {+ color: var(--text);+ }+ .step-pip[data-state='active'] .num {+ background: var(--accent);+ border-color: var(--accent);+ color: var(--accent-ink);+ transform: scale(1.06);+ }+ .step-pip[data-state='done'] {+ color: var(--text);+ }+ .step-pip[data-state='done'] .num {+ background: rgba(74, 222, 128, 0.12);+ border-color: rgba(74, 222, 128, 0.5);+ color: var(--ok);+ }+ .step-pip[data-clickable='true'] {+ cursor: pointer;+ }+ .step-pip[data-clickable='true']:hover .num {+ border-color: var(--accent);+ }+ .step-pip .label {+ display: none;+ }+ .step-bar {+ flex: 1 1 18px;+ min-width: 14px;+ max-width: 48px;+ height: 1.5px;+ background: var(--border-strong);+ margin: 0 4px;+ }+ .step-bar[data-state='done'] {+ background: rgba(74, 222, 128, 0.5);+ }+ @media (min-width: 720px) {+ .step-pip .label {+ display: inline;+ }+ }++ /* ── Card / panel ───────────────────────────────────────────────── */+ .wizard-card {+ border: 1px solid var(--border);+ border-radius: 18px;+ background: var(--panel);+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);+ overflow: hidden;+ }+ .wizard-body {+ padding: 30px 30px 26px;+ }+ .panel {+ display: none;+ animation: panel-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;+ }+ .panel.is-active {+ display: block;+ }+ @keyframes panel-in {+ from {+ opacity: 0;+ transform: translateY(8px);+ }+ to {+ opacity: 1;+ transform: translateY(0);+ }+ }+ .panel-eyebrow {+ font-size: 11px;+ font-weight: 600;+ letter-spacing: 0.09em;+ text-transform: uppercase;+ color: var(--faint);+ margin: 0 0 6px;+ }+ .panel-title {+ font-family: var(--font-display);+ font-size: 21px;+ font-weight: 600;+ margin: 0 0 6px;+ letter-spacing: -0.015em;+ }+ .panel-help {+ color: var(--muted);+ font-size: 13.5px;+ margin: 0 0 22px;+ line-height: 1.55;+ }++ /* ── Fields ─────────────────────────────────────────────────────── */+ .field {+ margin-bottom: 20px;+ }+ .field:last-child {+ margin-bottom: 0;+ }+ .field-label {+ display: flex;+ align-items: baseline;+ justify-content: space-between;+ gap: 10px;+ font-size: 13px;+ font-weight: 600;+ margin: 0 0 7px;+ color: var(--text);+ }+ .field-label .req {+ color: var(--err);+ font-weight: 700;+ }+ .field-label .count {+ font-size: 11.5px;+ font-weight: 500;+ color: var(--faint);+ }+ .field-hint {+ font-size: 12px;+ color: var(--muted);+ margin: 6px 0 0;+ line-height: 1.5;+ }+ .input,+ .textarea,+ .select {+ width: 100%;+ background: var(--panel-2);+ border: 1px solid var(--border-strong);+ border-radius: 10px;+ color: var(--text);+ font: inherit;+ font-size: 14px;+ padding: 11px 13px;+ transition:+ border-color 0.16s,+ box-shadow 0.16s,+ background 0.16s;+ outline: none;+ }+ .textarea {+ resize: vertical;+ min-height: 84px;+ line-height: 1.5;+ }+ .input:focus,+ .textarea:focus,+ .select:focus {+ border-color: rgba(255, 255, 255, 0.5);+ box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);+ background: #141414;+ }+ .input::placeholder,+ .textarea::placeholder {+ color: #555;+ }+ .input.is-invalid,+ .select.is-invalid {+ border-color: rgba(248, 113, 113, 0.6);+ box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.1);+ }+ .select {+ appearance: none;+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");+ background-repeat: no-repeat;+ background-position: right 13px center;+ padding-right: 34px;+ cursor: pointer;+ }+ .field-error {+ display: none;+ color: var(--err);+ font-size: 12px;+ margin: 7px 0 0;+ }+ .field-error.show {+ display: block;+ }++ /* ── Tag / chip input ───────────────────────────────────────────── */+ .tagbox {+ display: flex;+ flex-wrap: wrap;+ gap: 7px;+ align-items: center;+ background: var(--panel-2);+ border: 1px solid var(--border-strong);+ border-radius: 10px;+ padding: 8px 10px;+ transition: border-color 0.16s;+ }+ .tagbox:focus-within {+ border-color: rgba(255, 255, 255, 0.5);+ }+ .tag {+ display: inline-flex;+ align-items: center;+ gap: 6px;+ background: rgba(255, 255, 255, 0.07);+ border: 1px solid var(--border-strong);+ border-radius: 7px;+ padding: 3px 5px 3px 9px;+ font-size: 12.5px;+ color: var(--text);+ animation: panel-in 0.18s ease both;+ }+ .tag button {+ display: grid;+ place-items: center;+ width: 16px;+ height: 16px;+ border: 0;+ border-radius: 4px;+ background: transparent;+ color: var(--muted);+ cursor: pointer;+ font-size: 14px;+ line-height: 1;+ padding: 0;+ transition:+ background 0.14s,+ color 0.14s;+ }+ .tag button:hover {+ background: rgba(255, 255, 255, 0.12);+ color: #fff;+ }+ .tagbox input {+ flex: 1;+ min-width: 100px;+ border: 0;+ background: transparent;+ color: var(--text);+ font: inherit;+ font-size: 14px;+ padding: 4px 2px;+ outline: none;+ }+ .tagbox input::placeholder {+ color: #555;+ }++ /* ── Selectable option grid (model / skills / voice) ────────────── */+ .opt-grid {+ display: grid;+ gap: 12px;+ }+ .opt-grid.cols-2 {+ grid-template-columns: repeat(2, 1fr);+ }+ .opt-grid.cols-3 {+ grid-template-columns: repeat(3, 1fr);+ }+ .opt {+ position: relative;+ display: flex;+ flex-direction: column;+ gap: 8px;+ text-align: left;+ padding: 15px;+ border: 1.5px solid var(--border-strong);+ border-radius: 13px;+ background: var(--panel-2);+ color: inherit;+ font: inherit;+ cursor: pointer;+ transition:+ border-color 0.16s,+ background 0.16s,+ transform 0.16s;+ }+ .opt:hover {+ border-color: rgba(255, 255, 255, 0.3);+ transform: translateY(-1px);+ }+ .opt:focus-visible {+ outline: 2px solid var(--accent);+ outline-offset: 2px;+ }+ .opt[aria-pressed='true'],+ .opt.is-selected {+ border-color: var(--accent);+ background: rgba(255, 255, 255, 0.05);+ }+ .opt[aria-pressed='true']::after,+ .opt.is-selected::after {+ content: '';+ position: absolute;+ top: 11px;+ right: 11px;+ width: 18px;+ height: 18px;+ border-radius: 50%;+ background: var(--accent)+ url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E")+ center / 12px no-repeat;+ }+ .opt-icon {+ width: 34px;+ height: 34px;+ border-radius: 9px;+ background: rgba(255, 255, 255, 0.05);+ border: 1px solid var(--border-strong);+ display: grid;+ place-items: center;+ color: #cfd2e0;+ }+ .opt-icon svg {+ width: 18px;+ height: 18px;+ }+ .opt-name {+ font-size: 14px;+ font-weight: 600;+ letter-spacing: -0.01em;+ }+ .opt-desc {+ font-size: 12px;+ color: var(--muted);+ line-height: 1.5;+ }++ /* ── Model step ─────────────────────────────────────────────────── */+ .model-preview {+ margin-top: 18px;+ height: 260px;+ border: 1px solid var(--border);+ border-radius: 14px;+ background:+ radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.05) 0, transparent 60%),+ rgba(255, 255, 255, 0.015);+ overflow: hidden;+ position: relative;+ }+ .model-preview model-viewer {+ width: 100%;+ height: 100%;+ --poster-color: transparent;+ }+ .model-preview-empty {+ position: absolute;+ inset: 0;+ display: flex;+ flex-direction: column;+ align-items: center;+ justify-content: center;+ gap: 8px;+ color: var(--faint);+ font-size: 12.5px;+ text-align: center;+ padding: 20px;+ }+ .model-preview-empty svg {+ width: 30px;+ height: 30px;+ opacity: 0.5;+ }+ .starter-grid {+ display: grid;+ grid-template-columns: repeat(4, 1fr);+ gap: 10px;+ margin-top: 6px;+ }+ .starter {+ border: 1.5px solid var(--border-strong);+ border-radius: 12px;+ background: var(--panel-2);+ padding: 8px;+ cursor: pointer;+ transition:+ border-color 0.16s,+ transform 0.16s;+ display: flex;+ flex-direction: column;+ gap: 6px;+ align-items: center;+ }+ .starter:hover {+ border-color: rgba(255, 255, 255, 0.3);+ transform: translateY(-1px);+ }+ .starter:focus-visible {+ outline: 2px solid var(--accent);+ outline-offset: 2px;+ }+ .starter.is-selected {+ border-color: var(--accent);+ background: rgba(255, 255, 255, 0.05);+ }+ .starter-thumb {+ width: 100%;+ aspect-ratio: 1;+ border-radius: 8px;+ background:+ radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.06) 0, transparent 65%),+ rgba(255, 255, 255, 0.02);+ display: grid;+ place-items: center;+ overflow: hidden;+ }+ .starter-thumb model-viewer {+ width: 100%;+ height: 100%;+ }+ .starter-name {+ font-size: 11.5px;+ color: var(--muted);+ font-weight: 500;+ }+ .starter.is-selected .starter-name {+ color: var(--text);+ }+ .dropzone {+ margin-top: 6px;+ border: 1.5px dashed var(--border-strong);+ border-radius: 12px;+ padding: 26px 20px;+ text-align: center;+ cursor: pointer;+ transition:+ border-color 0.16s,+ background 0.16s;+ color: var(--muted);+ }+ .dropzone:hover,+ .dropzone.is-drag {+ border-color: rgba(255, 255, 255, 0.45);+ background: rgba(255, 255, 255, 0.02);+ color: var(--text);+ }+ .dropzone svg {+ width: 26px;+ height: 26px;+ opacity: 0.6;+ margin-bottom: 8px;+ }+ .dropzone-title {+ font-size: 13.5px;+ font-weight: 600;+ color: var(--text);+ }+ .dropzone-sub {+ font-size: 12px;+ margin-top: 3px;+ }+ .dropzone .file-name {+ color: var(--ok);+ font-weight: 600;+ }+ .model-tabs {+ display: flex;+ gap: 6px;+ margin-bottom: 14px;+ border-bottom: 1px solid var(--border);+ }+ .model-tab {+ appearance: none;+ border: 0;+ background: transparent;+ color: var(--muted);+ font: inherit;+ font-size: 13px;+ font-weight: 500;+ padding: 8px 12px;+ cursor: pointer;+ border-bottom: 2px solid transparent;+ margin-bottom: -1px;+ transition:+ color 0.16s,+ border-color 0.16s;+ }+ .model-tab:hover {+ color: var(--text);+ }+ .model-tab.is-active {+ color: var(--text);+ border-bottom-color: var(--accent);+ }+ .model-pane {+ display: none;+ }+ .model-pane.is-active {+ display: block;+ }++ /* ── Skills ─────────────────────────────────────────────────────── */+ .skill-row {+ display: flex;+ align-items: center;+ gap: 12px;+ padding: 12px 14px;+ border: 1px solid var(--border-strong);+ border-radius: 11px;+ background: var(--panel-2);+ margin-bottom: 9px;+ transition: border-color 0.16s;+ }+ .skill-row.locked {+ opacity: 0.85;+ }+ .skill-info {+ flex: 1;+ min-width: 0;+ }+ .skill-name {+ font-size: 13.5px;+ font-weight: 600;+ display: flex;+ align-items: center;+ gap: 8px;+ }+ .skill-name .core-pill {+ font-size: 9.5px;+ font-weight: 600;+ letter-spacing: 0.05em;+ text-transform: uppercase;+ color: var(--faint);+ border: 1px solid var(--border-strong);+ border-radius: 5px;+ padding: 1px 5px;+ }+ .skill-desc {+ font-size: 12px;+ color: var(--muted);+ margin-top: 2px;+ line-height: 1.45;+ }+ /* toggle */+ .toggle {+ position: relative;+ width: 40px;+ height: 23px;+ flex: 0 0 auto;+ cursor: pointer;+ }+ .toggle input {+ position: absolute;+ opacity: 0;+ width: 100%;+ height: 100%;+ margin: 0;+ cursor: pointer;+ }+ .toggle .track {+ position: absolute;+ inset: 0;+ border-radius: 999px;+ background: #2a2a2a;+ border: 1px solid var(--border-strong);+ transition: background 0.18s;+ }+ .toggle .knob {+ position: absolute;+ top: 3px;+ left: 3px;+ width: 16px;+ height: 16px;+ border-radius: 50%;+ background: #888;+ transition:+ transform 0.18s,+ background 0.18s;+ }+ .toggle input:checked ~ .track {+ background: rgba(255, 255, 255, 0.9);+ border-color: transparent;+ }+ .toggle input:checked ~ .knob {+ transform: translateX(17px);+ background: #000;+ }+ .toggle input:disabled {+ cursor: not-allowed;+ }+ .toggle input:focus-visible ~ .track {+ box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18);+ }+ .skills-meta {+ font-size: 12px;+ color: var(--muted);+ margin: 16px 0 0;+ text-align: center;+ }++ /* ── Review ─────────────────────────────────────────────────────── */+ .review-grid {+ display: grid;+ gap: 12px;+ }+ .review-row {+ display: flex;+ gap: 14px;+ padding: 14px 16px;+ border: 1px solid var(--border-strong);+ border-radius: 12px;+ background: var(--panel-2);+ align-items: flex-start;+ }+ .review-key {+ flex: 0 0 96px;+ font-size: 12px;+ font-weight: 600;+ color: var(--faint);+ text-transform: uppercase;+ letter-spacing: 0.05em;+ padding-top: 1px;+ }+ .review-val {+ flex: 1;+ min-width: 0;+ font-size: 13.5px;+ color: var(--text);+ line-height: 1.5;+ word-break: break-word;+ }+ .review-val .dim {+ color: var(--muted);+ }+ .review-val .chips {+ display: flex;+ flex-wrap: wrap;+ gap: 6px;+ margin-top: 2px;+ }+ .review-val .mini-chip {+ font-size: 11.5px;+ padding: 2px 8px;+ border-radius: 6px;+ background: rgba(255, 255, 255, 0.06);+ border: 1px solid var(--border-strong);+ color: var(--text);+ }+ .review-edit {+ background: 0;+ border: 0;+ color: var(--faint);+ font: inherit;+ font-size: 12px;+ cursor: pointer;+ padding: 0;+ text-decoration: underline;+ text-underline-offset: 2px;+ white-space: nowrap;+ align-self: center;+ }+ .review-edit:hover {+ color: var(--text);+ }+ .publish-box {+ display: flex;+ gap: 12px;+ align-items: flex-start;+ margin-top: 16px;+ padding: 14px 16px;+ border: 1px solid var(--border-strong);+ border-radius: 12px;+ background: rgba(255, 255, 255, 0.02);+ }+ .publish-box .toggle {+ margin-top: 1px;+ }+ .publish-text strong {+ font-size: 13.5px;+ display: block;+ margin-bottom: 2px;+ }+ .publish-text span {+ font-size: 12px;+ color: var(--muted);+ line-height: 1.5;+ }++ /* ── Footer nav (prev/next) ─────────────────────────────────────── */+ .wizard-foot {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 12px;+ padding: 18px 30px;+ border-top: 1px solid var(--border);+ background: rgba(255, 255, 255, 0.015);+ }+ .foot-msg {+ flex: 1;+ font-size: 12.5px;+ color: var(--muted);+ min-height: 18px;+ }+ .foot-msg.err {+ color: var(--err);+ }+ .foot-msg.ok {+ color: var(--ok);+ }+ .foot-actions {+ display: flex;+ gap: 10px;+ flex: 0 0 auto;+ }++ /* ── Auth gate ──────────────────────────────────────────────────── */+ .auth-gate {+ display: none;+ text-align: center;+ padding: 40px 24px;+ }+ .auth-gate.show {+ display: block;+ }+ .auth-gate svg {+ width: 40px;+ height: 40px;+ color: var(--muted);+ margin-bottom: 14px;+ }+ .auth-gate h2 {+ font-family: var(--font-display);+ font-size: 19px;+ margin: 0 0 8px;+ }+ .auth-gate p {+ color: var(--muted);+ font-size: 13.5px;+ max-width: 380px;+ margin: 0 auto 20px;+ }++ /* ── Success ────────────────────────────────────────────────────── */+ .success {+ display: none;+ text-align: center;+ padding: 24px 24px 12px;+ animation: panel-in 0.4s ease both;+ }+ .success.show {+ display: block;+ }+ .success-badge {+ width: 60px;+ height: 60px;+ margin: 0 auto 18px;+ border-radius: 50%;+ display: grid;+ place-items: center;+ background: rgba(74, 222, 128, 0.12);+ border: 1.5px solid rgba(74, 222, 128, 0.5);+ color: var(--ok);+ }+ .success-badge svg {+ width: 30px;+ height: 30px;+ }+ .success h2 {+ font-family: var(--font-display);+ font-size: 23px;+ margin: 0 0 8px;+ }+ .success p {+ color: var(--muted);+ font-size: 14px;+ max-width: 420px;+ margin: 0 auto 22px;+ }+ .success-preview {+ width: 180px;+ height: 180px;+ margin: 0 auto 22px;+ border: 1px solid var(--border);+ border-radius: 16px;+ overflow: hidden;+ background: rgba(255, 255, 255, 0.02);+ }+ .success-preview model-viewer {+ width: 100%;+ height: 100%;+ }+ .success-actions {+ display: flex;+ gap: 10px;+ justify-content: center;+ flex-wrap: wrap;+ }++ @media (max-width: 640px) {+ main.stage {+ padding: 28px 14px 72px;+ }+ .wizard-body {+ padding: 22px 18px 20px;+ }+ .wizard-foot {+ padding: 16px 18px;+ }+ .opt-grid.cols-2,+ .opt-grid.cols-3 {+ grid-template-columns: 1fr;+ }+ .starter-grid {+ grid-template-columns: repeat(2, 1fr);+ }+ .review-key {+ flex-basis: 74px;+ }+ }+ </style>++ <script+ type="module"+ src="https://ajax.googleapis.com/ajax/libs/model-viewer/4.0.0/model-viewer.min.js"+ ></script>+ <link rel="canonical" href="https://three.ws/create-agent" />+ </head>+ <body>+ <div id="page-loading" aria-hidden="true">+ <img src="/three.svg" alt="" />+ <div class="dots">...</div>+ </div>+ <a href="#main-content" class="skip-link">Skip to main content</a>+ <header>+ <div id="nav-container"></div>+ </header>+ <script src="/nav.js"></script>++ <main class="stage" id="main-content">+ <div class="wizard-head">+ <h1 class="wizard-title">Create an agent</h1>+ <p class="wizard-sub">Five quick steps — name it, give it a body, pick its skills, set its voice, ship it.</p>+ </div>++ <ol class="stepper" id="stepper" aria-label="Progress"></ol>++ <div class="wizard-card">+ <!-- Auth gate (shown when not signed in) -->+ <div class="auth-gate" id="auth-gate">+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round">+ <rect x="3" y="11" width="18" height="11" rx="2" />+ <path d="M7 11V7a5 5 0 0 1 10 0v4" />+ </svg>+ <h2>Sign in to create your agent</h2>+ <p>Your agent gets its own wallet and on-chain identity, so we need an account to anchor it to. It takes a few seconds.</p>+ <a class="btn btn--primary btn--lg" id="auth-gate-signin" href="/login?next=%2Fcreate-agent">Sign in to continue</a>+ </div>++ <!-- Wizard form -->+ <form id="wizard" novalidate>+ <div class="wizard-body" id="wizard-body">+ <!-- Step 1 — Basics -->+ <section class="panel is-active" data-step="0" aria-label="Basic info">+ <p class="panel-eyebrow">Step 1 of 5</p>+ <h2 class="panel-title">The basics</h2>+ <p class="panel-help">Give your agent a name and a short description. This is what people see first in the marketplace and on its profile.</p>++ <div class="field">+ <label class="field-label" for="f-name">+ <span>Agent name <span class="req" aria-hidden="true">*</span></span>+ <span class="count" id="name-count">0 / 60</span>+ </label>+ <input class="input" id="f-name" type="text" maxlength="60" autocomplete="off" placeholder="e.g. Nova, Atlas, Market Oracle" aria-required="true" />+ <p class="field-error" id="name-error">Please enter a name for your agent.</p>+ </div>++ <div class="field">+ <label class="field-label" for="f-description">+ <span>Description</span>+ <span class="count" id="desc-count">0 / 280</span>+ </label>+ <textarea class="textarea" id="f-description" maxlength="280" placeholder="What does this agent do? Who is it for?"></textarea>+ <p class="field-hint">One or two sentences. You can refine this later.</p>+ </div>++ <div class="field">+ <label class="field-label" for="f-tags-input"><span>Tags</span></label>+ <div class="tagbox" id="tagbox">+ <input id="f-tags-input" type="text" autocomplete="off" placeholder="Type a tag and press Enter" aria-describedby="tags-hint" />+ </div>+ <p class="field-hint" id="tags-hint">Press Enter or comma to add. Tags help people discover your agent. Up to 8.</p>+ </div>+ </section>++ <!-- Step 2 — 3D Model -->+ <section class="panel" data-step="1" aria-label="3D model">+ <p class="panel-eyebrow">Step 2 of 5</p>+ <h2 class="panel-title">Give it a body</h2>+ <p class="panel-help">Pick a ready-made 3D character or upload your own glTF model. You can always swap it later.</p>++ <div class="model-tabs" role="tablist">+ <button type="button" class="model-tab is-active" data-pane="starter" role="tab" aria-selected="true">Starter library</button>+ <button type="button" class="model-tab" data-pane="upload" role="tab" aria-selected="false">Upload your own</button>+ <button type="button" class="model-tab" data-pane="skip" role="tab" aria-selected="false">Add later</button>+ </div>++ <div class="model-pane is-active" data-pane="starter">+ <div class="starter-grid" id="starter-grid"></div>+ </div>++ <div class="model-pane" data-pane="upload">+ <div class="dropzone" id="dropzone" role="button" tabindex="0" aria-label="Upload a GLB file">+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round">+ <polyline points="16 16 12 12 8 16" />+ <line x1="12" y1="12" x2="12" y2="21" />+ <path d="M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3" />+ </svg>+ <div class="dropzone-title" id="dropzone-title">Drop a .glb file or click to browse</div>+ <div class="dropzone-sub" id="dropzone-sub">Any glTF 2.0 binary model, up to 16 MB</div>+ </div>+ <input type="file" id="glb-input" accept=".glb,model/gltf-binary" hidden />+ </div>++ <div class="model-pane" data-pane="skip">+ <p class="panel-help" style="margin: 6px 0 0">+ No problem — you can create the agent now and attach a 3D model anytime from its editor.+ It'll use a neutral placeholder until then.+ </p>+ </div>++ <div class="model-preview" id="model-preview">+ <div class="model-preview-empty" id="model-preview-empty">+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round">+ <path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z" />+ <polyline points="3.27 6.96 12 12.01 20.73 6.96" />+ <line x1="12" y1="22.08" x2="12" y2="12" />+ </svg>+ <span>Select a model to preview it in 3D</span>+ </div>+ </div>+ </section>++ <!-- Step 3 — Skills -->+ <section class="panel" data-step="2" aria-label="Skills">+ <p class="panel-eyebrow">Step 3 of 5</p>+ <h2 class="panel-title">Pick its skills</h2>+ <p class="panel-help">Every agent ships with a core set. Toggle on extra capabilities to extend what yours can do.</p>++ <div id="core-skills" aria-label="Core skills"></div>+ <div id="optional-skills" aria-label="Optional skills"></div>+ <p class="skills-meta" id="skills-meta">5 skills selected</p>+ </section>++ <!-- Step 4 — Personality & Voice -->+ <section class="panel" data-step="3" aria-label="Personality and voice">+ <p class="panel-eyebrow">Step 4 of 5</p>+ <h2 class="panel-title">Personality & voice</h2>+ <p class="panel-help">Shape how your agent talks. A category and a profile prompt are what publish it to the marketplace.</p>++ <div class="field">+ <label class="field-label" for="f-category"><span>Category</span></label>+ <select class="select" id="f-category">+ <option value="">Choose a category…</option>+ </select>+ <p class="field-hint">Required to list on the marketplace. Pick the closest fit.</p>+ </div>++ <div class="field">+ <label class="field-label" for="f-greeting">+ <span>Greeting</span>+ <span class="count" id="greet-count">0 / 200</span>+ </label>+ <input class="input" id="f-greeting" type="text" maxlength="200" placeholder="Hey, I'm Nova — ask me anything about pump.fun." />+ <p class="field-hint">The first line your agent says when someone opens a chat.</p>+ </div>++ <div class="field">+ <label class="field-label" for="f-persona">+ <span>Profile & instructions</span>+ <span class="count" id="persona-count">0 / 2000</span>+ </label>+ <textarea class="textarea" id="f-persona" maxlength="2000" style="min-height: 120px" placeholder="Describe who your agent is and how it should behave. e.g. 'You are Nova, a sharp, friendly Solana market analyst. Be concise, cite on-chain data, and never give financial advice.'"></textarea>+ <p class="field-hint">This becomes the agent's system prompt — its personality and rules.</p>+ </div>++ <div class="field">+ <label class="field-label"><span>Voice</span></label>+ <div class="opt-grid cols-2">+ <button type="button" class="opt is-selected" id="voice-browser" data-voice="browser" aria-pressed="true">+ <div class="opt-icon">+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round">+ <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5" />+ <path d="M15.54 8.46a5 5 0 0 1 0 7.07" />+ </svg>+ </div>+ <span class="opt-name">Built-in voice</span>+ <span class="opt-desc">Free browser text-to-speech. Works instantly, no setup.</span>+ </button>+ <button type="button" class="opt" id="voice-custom" data-voice="custom" aria-pressed="false">+ <div class="opt-icon">+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round">+ <path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" />+ <path d="M19 10v2a7 7 0 0 1-14 0v-2" />+ <line x1="12" y1="19" x2="12" y2="23" />+ </svg>+ </div>+ <span class="opt-name">Custom voice</span>+ <span class="opt-desc">Pick or clone a premium voice in the editor after creating.</span>+ </button>+ </div>+ <p class="field-hint">Starts on the built-in voice — you can upgrade to a premium or cloned voice anytime.</p>+ </div>+ </section>++ <!-- Step 5 — Review -->+ <section class="panel" data-step="4" aria-label="Review and create">+ <p class="panel-eyebrow">Step 5 of 5</p>+ <h2 class="panel-title">Review & create</h2>+ <p class="panel-help">Here's the agent you're about to ship. Edit any step, then create it.</p>++ <div class="review-grid" id="review-grid"></div>++ <div class="publish-box">+ <label class="toggle">+ <input type="checkbox" id="f-publish" checked />+ <span class="track"></span>+ <span class="knob"></span>+ </label>+ <div class="publish-text">+ <strong>List on the agent marketplace</strong>+ <span id="publish-note">Make your agent discoverable. Requires a category and a profile prompt. You can unlist anytime.</span>+ </div>+ </div>+ </section>++ <!-- Success -->+ <section class="success" id="success" aria-live="polite">+ <div class="success-badge">+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round">+ <polyline points="20 6 9 17 4 12" />+ </svg>+ </div>+ <h2 id="success-title">Your agent is live</h2>+ <p id="success-sub">It now has its own wallet and on-chain identity. Open it to chat, customize, or share.</p>+ <div class="success-preview" id="success-preview" hidden></div>+ <div class="success-actions">+ <a class="btn btn--primary btn--lg" id="success-open" href="#">Open agent</a>+ <a class="btn btn--secondary btn--lg" id="success-edit" href="#">Customize further</a>+ <a class="btn btn--ghost btn--lg" href="/create-agent">Create another</a>+ </div>+ </section>+ </div>++ <div class="wizard-foot" id="wizard-foot">+ <div class="foot-msg" id="foot-msg" role="status" aria-live="polite"></div>+ <div class="foot-actions">+ <button type="button" class="btn btn--ghost" id="btn-back" hidden>Back</button>+ <button type="button" class="btn btn--primary" id="btn-next">Next</button>+ <button type="submit" class="btn btn--primary" id="btn-create" hidden aria-label="Create agent">Create agent</button>+ </div>+ </div>+ </form>+ </div>+ </main>++ <div id="footer-container"></div>+ <script src="/footer.js"></script>+ <script type="module" src="/src/create-agent.js"></script>+ </body>+</html>diff --git a/pages/create.html b/pages/create.htmlindex 5396aefa7..37d819735 100644--- a/pages/create.html+++ b/pages/create.html@@ -1045,105 +1045,6 @@</p></div></main>-- <footer class="h-footer-horizon">- <div class="h-footer-glow-line" aria-hidden="true"></div>- <div class="h-footer-floor" aria-hidden="true"></div>- <div class="h-footer-haze" aria-hidden="true"></div>- <div class="h-footer-watermark" aria-hidden="true">three.ws</div>- <div class="h-footer-avatar" aria-hidden="true">- <model-viewer- src="/animations/robotexpressive.glb"- auto-rotate- auto-rotate-delay="0"- rotation-per-second="20deg"- interaction-prompt="none"- camera-controls="false"- disable-zoom- shadow-intensity="0"- exposure="0.7"- environment-image="neutral"- camera-orbit="0deg 80deg 9m"- field-of-view="35deg"- loading="lazy"- ></model-viewer>- </div>- <div class="h-footer-cta">- <div class="h-footer-newsletter">- <h3>Stay in the loop</h3>- <p>Get updates on new features, agent tooling, and protocol changes.</p>- <form class="h-footer-newsletter-form" data-newsletter-form novalidate>- <input- type="email"- class="h-footer-newsletter-input"- name="email"- placeholder="Enter your email"- aria-label="Email address"- autocomplete="email"- required- />- <button type="submit" class="h-footer-newsletter-btn" aria-label="Subscribe">- <svg viewBox="0 0 16 16" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" d="M2 8h11m0 0L9 4m4 4l-4 4"/></svg>- </button>- </form>- <p class="h-footer-newsletter-msg" data-newsletter-msg aria-live="polite"></p>- </div>- <div class="h-footer-community">- <h3>Join the community</h3>- <p>Follow along for builds, demos, and conversations with the team.</p>- <a class="h-footer-community-btn" href="https://x.com/trythreews" target="_blank" rel="noopener">- <svg viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg>- Follow on X- </a>- </div>- </div>- <div class="h-footer-inner">- <div class="h-footer-brand-col">- <div class="h-footer-brand">- <img class="wordmark-logo" src="/three.svg" alt="" aria-hidden="true" />- <span class="wordmark-dot" aria-hidden="true"></span>- <span>three.ws</span>- </div>- <p class="h-footer-tagline">Give your AI a body.</p>- <div class="h-footer-socials">- <a class="h-footer-social" href="https://x.com/trythreews" target="_blank" rel="noopener" aria-label="three.ws on X">- <svg viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg>- </a>- <a class="h-footer-social" href="https://github.com/nirholas/three.ws" target="_blank" rel="noopener" aria-label="three.ws on GitHub">- <svg viewBox="0 0 16 16" aria-hidden="true"><path fill="currentColor" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>- </a>- </div>- </div>- <nav class="h-footer-links" aria-label="Footer">- <div class="h-footer-link-col">- <h4 class="h-footer-link-heading">Product</h4>- <a href="/create">Create</a>- <a href="/studio">Studio</a>- <a href="/widgets">Widgets</a>- <a href="/discover">Discover</a>- </div>- <div class="h-footer-link-col">- <h4 class="h-footer-link-heading">Developers</h4>- <a href="/docs">Docs</a>- <a href="https://github.com/nirholas/three.ws" target="_blank" rel="noopener">GitHub</a>- <a href="https://eips.ethereum.org/EIPS/eip-8004" target="_blank" rel="noopener">ERC-8004</a>- </div>- <div class="h-footer-link-col">- <h4 class="h-footer-link-heading">Resources</h4>- <a href="/blog">Blog</a>- <a href="/dashboard">Dashboard</a>- </div>- </nav>- </div>- <div class="h-footer-bottom">- <p class="h-footer-legal">© 2026 three.ws — All rights reserved.</p>- <div class="h-footer-legal-links">- <a href="/legal/privacy">Privacy Policy</a>- <a href="/legal/tos">Terms of Use</a>- </div>- </div>- </footer>-<labelfor="glb-input"class="visually-hidden"diff --git a/public/nav.html b/public/nav.htmlindex 4248c4005..935fa6561 100644--- a/public/nav.html+++ b/public/nav.html@@ -8,7 +8,8 @@<div class="nav-grp"><button type="button" class="nav-trigger" aria-haspopup="true" aria-expanded="false">Build<span class="nav-caret" aria-hidden="true">▾</span></button><div class="nav-pop" role="menu" aria-label="Build">- <a class="nav-mi" href="/create" role="menuitem"><span class="nav-mi-t">Create agent</span><span class="nav-mi-d">Avatar + brain wizard</span></a>+ <a class="nav-mi" href="/create-agent" role="menuitem"><span class="nav-mi-t">Create an agent <span class="nav-pill-sm">New</span></span><span class="nav-mi-d">Guided wizard: name, 3D body, skills, personality → ship it</span></a>+ <a class="nav-mi" href="/create" role="menuitem"><span class="nav-mi-t">Create avatar</span><span class="nav-mi-d">Pick or upload a 3D body</span></a><a class="nav-mi" href="/create/selfie" role="menuitem"><span class="nav-mi-t">Selfie to avatar</span><span class="nav-mi-d">One photo → rigged 3D avatar</span></a><a class="nav-mi" href="/avatar-studio" role="menuitem"><span class="nav-mi-t">Avatar Studio</span><span class="nav-mi-d">Sculpt face + body from scratch → export GLB</span></a><a class="nav-mi" href="/forge" role="menuitem"><span class="nav-mi-t">Text to 3D <span class="nav-pill-sm">New</span></span><span class="nav-mi-d">Describe an object → textured GLB</span></a>@@ -100,7 +101,7 @@</nav><div class="nav-end"><button type="button" class="nav-search-btn" data-search-open aria-label="Search (Cmd K)" title="Search">- <svg class="nav-search-ico" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><circle cx="7.5" cy="7.5" r="5"/><line x1="11.5" y1="11.5" x2="16" y2="16"/></svg>+ <svg class="nav-search-ico" width="14" height="14" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><circle cx="7.5" cy="7.5" r="5"/><line x1="11.5" y1="11.5" x2="16" y2="16"/></svg><span class="nav-search-label">Search</span><kbd class="nav-search-hint" aria-hidden="true">⌘K</kbd></button>diff --git a/src/app-next-overlay.js b/src/app-next-overlay.jsindex 9f0d9d357..0ffb1ce80 100644--- a/src/app-next-overlay.js+++ b/src/app-next-overlay.js@@ -49,6 +49,22 @@ const CAMERA_PRESETS = {hero: { framePadding: 1.55, heightFrac: 0.3, distFrac: 3.2, targetY: 0.55 },};+// Stage backdrops painted behind the transparent avatar canvas. Each `css` is a+// valid CSS `background` value (gradient or solid). `light` flips the swatch+// label to dark text. The agent can also set an arbitrary solid color via the+// chat ("make the background dark blue") — that arrives as a `nxt:backdrop`+// CustomEvent and is rendered as the "Custom" entry.+const BACKDROPS = [+ { id: 'studio', label: 'Studio', css: 'radial-gradient(circle at 50% 28%, #2b2b33 0%, #111116 72%)' },+ { id: 'aurora', label: 'Aurora', css: 'linear-gradient(165deg, #0a1f3a 0%, #123f54 48%, #1e6f60 100%)' },+ { id: 'sunset', label: 'Sunset', css: 'linear-gradient(165deg, #271238 0%, #7a2f4a 55%, #d9763c 100%)' },+ { id: 'mint', label: 'Mint', css: 'linear-gradient(165deg, #0c2a26 0%, #15463c 100%)' },+ { id: 'noir', label: 'Noir', css: '#050507' },+ { id: 'paper', label: 'Paper', css: 'linear-gradient(165deg, #f5f2ea 0%, #dcd6c9 100%)', light: true },+];+const BACKDROP_STORAGE_KEY = 'nxt:backdrop';+const DEFAULT_BACKDROP_ID = 'studio';+document.addEventListener('DOMContentLoaded', boot);function boot() {@@ -68,6 +84,8 @@ function boot() {wireDeployMirror();wireVisitorCard();wirePosterSkeleton();+ wireBackdrop();+ wireAvatarSwitcher();waitForViewer().then((viewer) => {if (!viewer) {@@ -1034,6 +1052,152 @@ function wireDeployMirror() {}}+// ── Backdrop switcher ──────────────────────────────────────────────────────+//+// The avatar canvas is kept transparent (see polishStage), so a full-bleed+// layer behind it sets the visible "scene". The agent can change it from chat+// (setBgColor → nxt:backdrop event) and the user can pick from a popover.++function applyBackdrop(value, { persistId } = {}) {+ const layer = document.getElementById('nxt-stage-backdrop');+ if (!layer) return;+ layer.style.background = value;+ layer.classList.add('is-painted');+ if (persistId) {+ try {+ localStorage.setItem(BACKDROP_STORAGE_KEY, persistId);+ } catch {}+ }+ // Reflect the active swatch in the popover, if open/built.+ document.querySelectorAll('.nxt-backdrop-swatch').forEach((b) => {+ b.classList.toggle('is-active', b.dataset.id === persistId);+ b.setAttribute('aria-pressed', b.dataset.id === persistId ? 'true' : 'false');+ });+}++function wireBackdrop() {+ const btn = document.getElementById('nxt-backdrop-btn');+ const pop = document.getElementById('nxt-backdrop-popover');+ const grid = document.getElementById('nxt-backdrop-grid');++ // Restore the saved (or default) backdrop even if the control markup is absent.+ let savedId = DEFAULT_BACKDROP_ID;+ try {+ const s = localStorage.getItem(BACKDROP_STORAGE_KEY);+ if (s) savedId = s;+ } catch {}+ const saved = BACKDROPS.find((b) => b.id === savedId);+ if (saved) applyBackdrop(saved.css, { persistId: saved.id });++ // The agent can paint an arbitrary solid color via chat.+ window.addEventListener('nxt:backdrop', (e) => {+ const value = e.detail?.value;+ if (typeof value === 'string') applyBackdrop(value, { persistId: 'custom' });+ });++ if (!btn || !pop || !grid) return;++ // Build the swatch grid once.+ grid.innerHTML = '';+ for (const b of BACKDROPS) {+ const swatch = document.createElement('button');+ swatch.type = 'button';+ swatch.className = 'nxt-backdrop-swatch' + (b.light ? ' is-light' : '');+ swatch.dataset.id = b.id;+ swatch.style.background = b.css;+ swatch.title = b.label;+ swatch.setAttribute('aria-pressed', b.id === savedId ? 'true' : 'false');+ if (b.id === savedId) swatch.classList.add('is-active');+ swatch.innerHTML = `<span class="nxt-backdrop-swatch__label">${escHtml(b.label)}</span>`;+ swatch.addEventListener('click', () => {+ applyBackdrop(b.css, { persistId: b.id });+ });+ grid.appendChild(swatch);+ }++ const open = () => {+ pop.hidden = false;+ btn.setAttribute('aria-expanded', 'true');+ };+ const close = () => {+ pop.hidden = true;+ btn.setAttribute('aria-expanded', 'false');+ };+ btn.addEventListener('click', () => (pop.hidden ? open() : close()));+ document.addEventListener('pointerdown', (e) => {+ if (pop.hidden) return;+ if (pop.contains(e.target) || btn.contains(e.target)) return;+ close();+ });+ document.addEventListener('keydown', (e) => {+ if (e.key === 'Escape' && !pop.hidden) close();+ });+}++// ── Avatar switcher ────────────────────────────────────────────────────────+//+// Opens the shared gallery picker (same component as /gallery) and swaps the+// loaded avatar to whatever the user chooses — "change the avatar like in the+// gallery", but without leaving the stage.++function wireAvatarSwitcher() {+ const btn = document.getElementById('nxt-avatar-btn');+ if (!btn) return;++ let opening = false;+ btn.addEventListener('click', async () => {+ if (opening) return;+ opening = true;+ btn.classList.add('is-loading');+ try {+ const { AvatarGalleryPicker } = await import('./avatar-gallery-picker.js');+ const currentId = new URLSearchParams(location.search).get('agent') || undefined;+ const picker = new AvatarGalleryPicker({+ source: 'public',+ title: 'Switch avatar',+ showModes: false,+ ctaLabel: 'Use this avatar',+ selectedId: currentId,+ onSelect: (avatar) => {+ if (avatar?.model_url) loadAvatarOntoStage(avatar);+ },+ });+ picker.openModal();+ } catch (err) {+ log.warn('[nxt] avatar picker failed to load', err);+ toast('Could not open the avatar gallery — try again.');+ } finally {+ btn.classList.remove('is-loading');+ opening = false;+ }+ });+}++function loadAvatarOntoStage(avatar) {+ const app = window.VIEWER?.app;+ if (!app || typeof app.view !== 'function') {+ toast('Viewer not ready — try again in a moment.');+ return;+ }+ toast(`Loading ${avatar.name || 'avatar'}…`);+ try {+ const result = app.view(avatar.model_url, '', new Map());+ Promise.resolve(result)+ .then(() => {+ // Reframe on the new avatar and refresh the (clip-dependent) chips.+ applyCameraPreset('body');+ window.dispatchEvent(new CustomEvent('viewer:model-loaded'));+ })+ .catch((err) => {+ log.warn('[nxt] avatar load failed', err);+ toast('Failed to load that avatar.');+ });+ } catch (err) {+ log.warn('[nxt] avatar view() threw', err);+ toast('Failed to load that avatar.');+ }+}+// ── Toast ─────────────────────────────────────────────────────────────────let toastTimer = null;diff --git a/src/create-agent.js b/src/create-agent.jsnew file mode 100644index 000000000..311e353e3--- /dev/null+++ b/src/create-agent.js@@ -0,0 +1,861 @@+// Agent Creation Wizard — /create-agent+//+// A five-step, state-driven flow that produces a real agent identity:+// 1. Basics → name, description, tags+// 2. 3D model → starter library | own GLB upload | attach later+// 3. Skills → core (always on) + optional capabilities+// 4. Personality → category, greeting, profile prompt, voice+// 5. Review → POST /api/agents, optional marketplace publish+//+// Everything writes through the same verified endpoints the agent editor uses+// (account.js#saveRemoteGlbToAccount for the model, /api/agents for the+// identity, /api/marketplace/agents/:id/publish for personality + listing) so+// there are no parallel code paths to drift out of sync.++import { apiFetch } from './api.js';+import { getMe, saveRemoteGlbToAccount } from './account.js';+import { log } from './shared/log.js';++const TOTAL_STEPS = 5;+const STEP_LABELS = ['Basics', 'Model', 'Skills', 'Personality', 'Review'];+const MAX_TAGS = 8;++// Marketplace categories — mirrors api/marketplace/[action].js CATEGORIES.+const CATEGORIES = [+ 'academic',+ 'career',+ 'copywriting',+ 'design',+ 'education',+ 'emotions',+ 'entertainment',+ 'games',+ 'general',+ 'life',+ 'marketing',+ 'office',+ 'programming',+ 'translation',+];++// Real starter models — public-domain / shipped GLBs already served from the+// site. Selecting one copies it into the user's own avatar library on create+// (saveRemoteGlbToAccount fetches the URL, uploads to their R2 namespace, and+// commits a real avatar record) — never a placeholder reference.+const STARTERS = [+ { id: 'default', name: 'Vern', url: '/avatars/default.glb' },+ { id: 'cz', name: 'CZ', url: '/avatars/cz.glb' },+ { id: 'robot', name: 'Saga', url: '/animations/robotexpressive.glb' },+ { id: 'soldier', name: 'Boss', url: '/animations/soldier.glb' },+];++// Core skills every agent gets — matches the API default set. Locked on.+const CORE_SKILLS = [+ { id: 'greet', name: 'Greet', desc: 'Welcomes visitors and opens the conversation.' },+ { id: 'present-model', name: 'Present model', desc: 'Shows off and explains its own 3D body.' },+ { id: 'validate-model', name: 'Validate model', desc: 'Checks rig and animation health on load.' },+ { id: 'remember', name: 'Remember', desc: 'Keeps memory across a conversation.' },+ { id: 'think', name: 'Think', desc: 'Reasons step by step before answering.' },+];++// Optional skills — a curated, real set the user can toggle on. Ids are stored+// verbatim in the agent's skills[] array.+const OPTIONAL_SKILLS = [+ { id: 'wave', name: 'Wave', desc: 'Waves at people on greet or on request.' },+ { id: 'dance', name: 'Dance', desc: 'Plays a dance animation loop on cue.' },+ {+ id: 'pump-fun',+ name: 'Pump.fun market intel',+ desc: 'Read-only Solana market data: tokens, bonding curves, trending, rug-risk.',+ },+ {+ id: 'explain-gltf',+ name: 'Explain glTF',+ desc: 'Narrates mesh, material, and animation info from the scene.',+ },+ { id: 'web-search', name: 'Web search', desc: 'Looks things up on the live web when asked.' },+];++// ── State ───────────────────────────────────────────────────────────────────++const state = {+ step: 0,+ name: '',+ description: '',+ tags: [],+ model: { mode: 'starter', starterId: '', starterUrl: '', file: null, fileName: '' },+ skills: new Set(CORE_SKILLS.map((s) => s.id)),+ category: '',+ greeting: '',+ persona: '',+ voice: 'browser',+ publish: true,+ submitting: false,+};++// ── DOM refs ────────────────────────────────────────────────────────────────++const $ = (id) => document.getElementById(id);+const el = {};++// ── Boot ────────────────────────────────────────────────────────────────────++async function boot() {+ cacheEls();+ renderStepper();+ renderStarters();+ renderSkills();+ renderCategories();+ wireBasics();+ wireModel();+ wirePersonality();+ wireNav();++ // Resolve auth. The whole flow requires an account (the agent gets a wallet),+ // so gate the form behind a sign-in prompt rather than letting the user fill+ // everything out only to hit a wall at the end.+ let me = null;+ try {+ me = await getMe();+ } catch (err) {+ log.warn('[create-agent] auth probe failed', err?.message);+ }+ $('page-loading')?.remove();+ if (!me) {+ showAuthGate();+ return;+ }+ showStep(0);+}++function cacheEls() {+ el.form = $('wizard');+ el.body = $('wizard-body');+ el.foot = $('wizard-foot');+ el.footMsg = $('foot-msg');+ el.back = $('btn-back');+ el.next = $('btn-next');+ el.create = $('btn-create');+ el.panels = Array.from(document.querySelectorAll('.panel'));+ el.success = $('success');+ el.authGate = $('auth-gate');+ el.preview = $('model-preview');+ el.previewEmpty = $('model-preview-empty');+}++function showAuthGate() {+ el.authGate.classList.add('show');+ el.form.style.display = 'none';+ // Carry the user back here after login.+ const next = encodeURIComponent('/create-agent');+ $('auth-gate-signin').href = `/login?next=${next}`;+}++// ── Stepper ─────────────────────────────────────────────────────────────────++function renderStepper() {+ const stepper = $('stepper');+ stepper.innerHTML = '';+ STEP_LABELS.forEach((label, i) => {+ if (i > 0) {+ const bar = document.createElement('li');+ bar.className = 'step-bar';+ bar.setAttribute('aria-hidden', 'true');+ bar.dataset.bar = String(i);+ stepper.appendChild(bar);+ }+ const li = document.createElement('li');+ li.className = 'step-pip';+ li.dataset.pip = String(i);+ li.innerHTML = `<span class="num">${i + 1}</span><span class="label">${label}</span>`;+ // Let users jump back to any completed step by clicking its pip.+ li.addEventListener('click', () => {+ if (i < state.step) showStep(i);+ });+ stepper.appendChild(li);+ });+}++function updateStepper() {+ document.querySelectorAll('.step-pip').forEach((pip) => {+ const i = Number(pip.dataset.pip);+ const done = i < state.step;+ pip.dataset.state = i === state.step ? 'active' : done ? 'done' : '';+ pip.dataset.clickable = done ? 'true' : 'false';+ if (done) pip.querySelector('.num').textContent = '✓';+ else pip.querySelector('.num').textContent = String(i + 1);+ });+ document.querySelectorAll('.step-bar').forEach((bar) => {+ bar.dataset.state = Number(bar.dataset.bar) <= state.step ? 'done' : '';+ });+}++// ── Step navigation ─────────────────────────────────────────────────────────++function showStep(n) {+ state.step = n;+ el.panels.forEach((p) => p.classList.toggle('is-active', Number(p.dataset.step) === n));+ updateStepper();+ clearMsg();++ el.back.hidden = n === 0;+ const isLast = n === TOTAL_STEPS - 1;+ el.next.hidden = isLast;+ el.create.hidden = !isLast;++ if (isLast) renderReview();+ if (n === 1) syncModelPreview();++ // Move focus to the first field of the step for keyboard users.+ const panel = el.panels.find((p) => Number(p.dataset.step) === n);+ const focusable = panel?.querySelector('input, textarea, select, button.opt, .starter, .dropzone');+ requestAnimationFrame(() => focusable?.focus?.({ preventScroll: true }));+ el.body.scrollIntoView({ behavior: 'smooth', block: 'start' });+}++function wireNav() {+ el.back.addEventListener('click', () => {+ if (state.step > 0) showStep(state.step - 1);+ });+ el.next.addEventListener('click', () => {+ if (validateStep(state.step)) showStep(state.step + 1);+ });+ el.form.addEventListener('submit', (e) => {+ e.preventDefault();+ submit();+ });+ // Enter on a text input advances rather than submitting the form early.+ el.form.addEventListener('keydown', (e) => {+ if (e.key !== 'Enter') return;+ const t = e.target;+ if (t.tagName === 'TEXTAREA') return;+ if (t.id === 'f-tags-input') return; // tag input handles Enter itself+ if (t.tagName === 'INPUT' || t.tagName === 'SELECT') {+ e.preventDefault();+ if (state.step < TOTAL_STEPS - 1) {+ if (validateStep(state.step)) showStep(state.step + 1);+ } else {+ submit();+ }+ }+ });+}++// ── Validation ──────────────────────────────────────────────────────────────++function validateStep(n) {+ clearMsg();+ if (n === 0) {+ if (!state.name.trim()) {+ $('f-name').classList.add('is-invalid');+ $('name-error').classList.add('show');+ $('f-name').focus();+ setMsg('Your agent needs a name.', 'err');+ return false;+ }+ }+ if (n === 3 && state.publish) {+ // Publishing needs a category + profile prompt. Don't hard-block the step —+ // just warn; the review step lets them turn off publishing instead.+ if (!state.category || !state.persona.trim()) {+ setMsg('Tip: add a category and a profile prompt to list on the marketplace.', '');+ }+ }+ return true;+}++// ── Step 1: Basics ──────────────────────────────────────────────────────────++function wireBasics() {+ const name = $('f-name');+ name.addEventListener('input', () => {+ state.name = name.value;+ $('name-count').textContent = `${name.value.length} / 60`;+ if (name.value.trim()) {+ name.classList.remove('is-invalid');+ $('name-error').classList.remove('show');+ }+ });++ const desc = $('f-description');+ desc.addEventListener('input', () => {+ state.description = desc.value;+ $('desc-count').textContent = `${desc.value.length} / 280`;+ });++ wireTagInput();+}++function wireTagInput() {+ const input = $('f-tags-input');+ const box = $('tagbox');++ const addTag = (raw) => {+ const t = raw.trim().toLowerCase().replace(/^#/, '');+ if (!t) return;+ if (state.tags.includes(t)) return;+ if (state.tags.length >= MAX_TAGS) {+ setMsg(`Up to ${MAX_TAGS} tags.`, '');+ return;+ }+ state.tags.push(t);+ renderTags();+ };++ input.addEventListener('keydown', (e) => {+ if (e.key === 'Enter' || e.key === ',') {+ e.preventDefault();+ addTag(input.value);+ input.value = '';+ } else if (e.key === 'Backspace' && !input.value && state.tags.length) {+ state.tags.pop();+ renderTags();+ }+ });+ input.addEventListener('blur', () => {+ if (input.value.trim()) {+ addTag(input.value);+ input.value = '';+ }+ });+ // Clicking anywhere in the box focuses the input.+ box.addEventListener('click', (e) => {+ if (e.target === box) input.focus();+ });++ function renderTags() {+ box.querySelectorAll('.tag').forEach((n) => n.remove());+ const frag = document.createDocumentFragment();+ state.tags.forEach((t) => {+ const chip = document.createElement('span');+ chip.className = 'tag';+ chip.innerHTML = `<span>${escapeHtml(t)}</span>`;+ const x = document.createElement('button');+ x.type = 'button';+ x.setAttribute('aria-label', `Remove tag ${t}`);+ x.textContent = '×';+ x.addEventListener('click', () => {+ state.tags = state.tags.filter((v) => v !== t);+ renderTags();+ });+ chip.appendChild(x);+ frag.appendChild(chip);+ });+ box.insertBefore(frag, input);+ }+ // expose for the personality step's reuse — not needed elsewhere now.+}++// ── Step 2: Model ───────────────────────────────────────────────────────────++function renderStarters() {+ const grid = $('starter-grid');+ grid.innerHTML = '';+ STARTERS.forEach((s) => {+ const card = document.createElement('button');+ card.type = 'button';+ card.className = 'starter';+ card.dataset.starter = s.id;+ card.setAttribute('aria-label', `Use the ${s.name} starter model`);+ card.innerHTML = `+ <span class="starter-thumb">+ <model-viewer src="${s.url}" alt="${s.name} preview" auto-rotate auto-rotate-delay="0"+ rotation-per-second="22deg" interaction-prompt="none" disable-zoom disable-pan disable-tap+ shadow-intensity="0.3" exposure="0.95" environment-image="neutral"+ camera-orbit="15deg 82deg auto" loading="lazy"></model-viewer>+ </span>+ <span class="starter-name">${s.name}</span>`;+ card.addEventListener('click', () => selectStarter(s.id));+ grid.appendChild(card);+ });+}++function selectStarter(id) {+ const s = STARTERS.find((x) => x.id === id);+ if (!s) return;+ state.model = { mode: 'starter', starterId: id, starterUrl: s.url, file: null, fileName: '' };+ document.querySelectorAll('.starter').forEach((c) =>+ c.classList.toggle('is-selected', c.dataset.starter === id),+ );+ syncModelPreview();+}++function wireModel() {+ // Tabs+ document.querySelectorAll('.model-tab').forEach((tab) => {+ tab.addEventListener('click', () => {+ const pane = tab.dataset.pane;+ document.querySelectorAll('.model-tab').forEach((t) => {+ const on = t === tab;+ t.classList.toggle('is-active', on);+ t.setAttribute('aria-selected', on ? 'true' : 'false');+ });+ document.querySelectorAll('.model-pane').forEach((p) =>+ p.classList.toggle('is-active', p.dataset.pane === pane),+ );+ if (pane === 'skip') {+ state.model = { mode: 'none', starterId: '', starterUrl: '', file: null, fileName: '' };+ document.querySelectorAll('.starter').forEach((c) => c.classList.remove('is-selected'));+ syncModelPreview();+ } else if (pane === 'starter' && state.model.mode !== 'starter') {+ // re-entering starter tab with nothing chosen — leave unselected+ }+ });+ });++ // Dropzone + file input+ const dz = $('dropzone');+ const input = $('glb-input');+ dz.addEventListener('click', () => input.click());+ dz.addEventListener('keydown', (e) => {+ if (e.key === 'Enter' || e.key === ' ') {+ e.preventDefault();+ input.click();+ }+ });+ ['dragover', 'dragenter'].forEach((ev) =>+ dz.addEventListener(ev, (e) => {+ e.preventDefault();+ dz.classList.add('is-drag');+ }),+ );+ ['dragleave', 'dragend', 'drop'].forEach((ev) =>+ dz.addEventListener(ev, () => dz.classList.remove('is-drag')),+ );+ dz.addEventListener('drop', (e) => {+ e.preventDefault();+ const f = e.dataTransfer?.files?.[0];+ if (f) acceptFile(f);+ });+ input.addEventListener('change', () => {+ const f = input.files?.[0];+ if (f) acceptFile(f);+ input.value = '';+ });+}++async function acceptFile(file) {+ if (!file.name.toLowerCase().endsWith('.glb')) {+ setMsg('Please choose a .glb file.', 'err');+ return;+ }+ if (file.size > 16 * 1024 * 1024) {+ setMsg('That file is over the 16 MB limit.', 'err');+ return;+ }+ // Verify GLB magic bytes ("glTF") before accepting.+ const header = new Uint8Array(await file.slice(0, 4).arrayBuffer());+ if (!(header[0] === 0x67 && header[1] === 0x6c && header[2] === 0x54 && header[3] === 0x46)) {+ setMsg("That doesn't look like a valid GLB file.", 'err');+ return;+ }+ clearMsg();+ state.model = {+ mode: 'upload',+ starterId: '',+ starterUrl: '',+ file,+ fileName: file.name.replace(/\.glb$/i, ''),+ };+ $('dropzone-title').innerHTML = `<span class="file-name">${escapeHtml(file.name)}</span> ready`;+ $('dropzone-sub').textContent = 'Click to choose a different file';+ syncModelPreview();+}++function syncModelPreview() {+ const url =+ state.model.mode === 'starter'+ ? state.model.starterUrl+ : state.model.mode === 'upload' && state.model.file+ ? URL.createObjectURL(state.model.file)+ : '';++ // Clear any previous viewer.+ el.preview.querySelector('model-viewer')?.remove();+ if (!url) {+ el.previewEmpty.style.display = '';+ return;+ }+ el.previewEmpty.style.display = 'none';+ const mv = document.createElement('model-viewer');+ mv.setAttribute('src', url);+ mv.setAttribute('alt', 'Selected model preview');+ mv.setAttribute('auto-rotate', '');+ mv.setAttribute('auto-rotate-delay', '0');+ mv.setAttribute('rotation-per-second', '18deg');+ mv.setAttribute('camera-controls', '');+ mv.setAttribute('interaction-prompt', 'none');+ mv.setAttribute('shadow-intensity', '0.4');+ mv.setAttribute('exposure', '0.95');+ mv.setAttribute('environment-image', 'neutral');+ mv.setAttribute('camera-orbit', '15deg 80deg auto');+ mv.setAttribute('loading', 'eager');+ el.preview.appendChild(mv);+}++// ── Step 3: Skills ──────────────────────────────────────────────────────────++function renderSkills() {+ const core = $('core-skills');+ core.innerHTML = '';+ CORE_SKILLS.forEach((s) => core.appendChild(skillRow(s, true)));++ const opt = $('optional-skills');+ opt.innerHTML = '';+ OPTIONAL_SKILLS.forEach((s) => opt.appendChild(skillRow(s, false)));+ updateSkillsMeta();+}++function skillRow(skill, locked) {+ const row = document.createElement('div');+ row.className = 'skill-row' + (locked ? ' locked' : '');+ const checked = state.skills.has(skill.id);+ row.innerHTML = `+ <div class="skill-info">+ <div class="skill-name">${escapeHtml(skill.name)}${locked ? '<span class="core-pill">Core</span>' : ''}</div>+ <div class="skill-desc">${escapeHtml(skill.desc)}</div>+ </div>+ <label class="toggle">+ <input type="checkbox" ${checked ? 'checked' : ''} ${locked ? 'disabled' : ''}+ aria-label="${escapeHtml(skill.name)}" />+ <span class="track"></span>+ <span class="knob"></span>+ </label>`;+ if (!locked) {+ const cb = row.querySelector('input');+ cb.addEventListener('change', () => {+ if (cb.checked) state.skills.add(skill.id);+ else state.skills.delete(skill.id);+ updateSkillsMeta();+ });+ }+ return row;+}++function updateSkillsMeta() {+ const n = state.skills.size;+ $('skills-meta').textContent = `${n} skill${n === 1 ? '' : 's'} selected`;+}++// ── Step 4: Personality & voice ─────────────────────────────────────────────++function renderCategories() {+ const sel = $('f-category');+ CATEGORIES.forEach((c) => {+ const o = document.createElement('option');+ o.value = c;+ o.textContent = c.charAt(0).toUpperCase() + c.slice(1);+ sel.appendChild(o);+ });+}++function wirePersonality() {+ $('f-category').addEventListener('change', (e) => {+ state.category = e.target.value;+ });+ const greet = $('f-greeting');+ greet.addEventListener('input', () => {+ state.greeting = greet.value;+ $('greet-count').textContent = `${greet.value.length} / 200`;+ });+ const persona = $('f-persona');+ persona.addEventListener('input', () => {+ state.persona = persona.value;+ $('persona-count').textContent = `${persona.value.length} / 2000`;+ });++ document.querySelectorAll('[data-voice]').forEach((btn) => {+ btn.addEventListener('click', () => {+ state.voice = btn.dataset.voice;+ document.querySelectorAll('[data-voice]').forEach((b) => {+ const on = b === btn;+ b.classList.toggle('is-selected', on);+ b.setAttribute('aria-pressed', on ? 'true' : 'false');+ });+ });+ });+}++// ── Step 5: Review ──────────────────────────────────────────────────────────++function renderReview() {+ const modelLabel =+ state.model.mode === 'starter'+ ? `${STARTERS.find((s) => s.id === state.model.starterId)?.name || 'Starter'} (starter)`+ : state.model.mode === 'upload'+ ? `${state.model.fileName}.glb (upload)`+ : 'Add later';++ const skillNames = [...CORE_SKILLS, ...OPTIONAL_SKILLS]+ .filter((s) => state.skills.has(s.id))+ .map((s) => s.name);++ const rows = [+ {+ key: 'Name',+ step: 0,+ html: state.name.trim()+ ? escapeHtml(state.name)+ : '<span class="dim">Unnamed</span>',+ },+ {+ key: 'About',+ step: 0,+ html: state.description.trim()+ ? escapeHtml(state.description)+ : '<span class="dim">No description</span>',+ },+ {+ key: 'Tags',+ step: 0,+ html: state.tags.length+ ? `<div class="chips">${state.tags.map((t) => `<span class="mini-chip">${escapeHtml(t)}</span>`).join('')}</div>`+ : '<span class="dim">None</span>',+ },+ { key: 'Body', step: 1, html: escapeHtml(modelLabel) },+ {+ key: 'Skills',+ step: 2,+ html: `<div class="chips">${skillNames.map((n) => `<span class="mini-chip">${escapeHtml(n)}</span>`).join('')}</div>`,+ },+ {+ key: 'Category',+ step: 3,+ html: state.category+ ? escapeHtml(state.category.charAt(0).toUpperCase() + state.category.slice(1))+ : '<span class="dim">Not set</span>',+ },+ {+ key: 'Greeting',+ step: 3,+ html: state.greeting.trim() ? escapeHtml(state.greeting) : '<span class="dim">Default</span>',+ },+ {+ key: 'Profile',+ step: 3,+ html: state.persona.trim()+ ? escapeHtml(truncate(state.persona, 160))+ : '<span class="dim">Not set</span>',+ },+ { key: 'Voice', step: 3, html: state.voice === 'browser' ? 'Built-in voice' : 'Custom (set up later)' },+ ];++ const grid = $('review-grid');+ grid.innerHTML = '';+ rows.forEach((r) => {+ const row = document.createElement('div');+ row.className = 'review-row';+ row.innerHTML = `+ <div class="review-key">${r.key}</div>+ <div class="review-val">${r.html}</div>+ <button type="button" class="review-edit" aria-label="Edit ${r.key}">Edit</button>`;+ row.querySelector('.review-edit').addEventListener('click', () => showStep(r.step));+ grid.appendChild(row);+ });++ // Publish toggle reflects state + gates on having what publish needs.+ const pub = $('f-publish');+ pub.checked = state.publish;+ pub.onchange = () => {+ state.publish = pub.checked;+ updatePublishNote();+ };+ updatePublishNote();+}++function updatePublishNote() {+ const note = $('publish-note');+ if (!state.publish) {+ note.textContent = 'Your agent will be private. You can list it anytime from its editor.';+ return;+ }+ const missing = [];+ if (!state.category) missing.push('a category');+ if (!state.persona.trim()) missing.push('a profile prompt');+ if (missing.length) {+ note.innerHTML = `Add ${missing.join(' and ')} (step 4) to list it. Otherwise it'll be created privately.`;+ } else {+ note.textContent = 'Discoverable on the marketplace right after creation. You can unlist anytime.';+ }+}++// ── Submit ──────────────────────────────────────────────────────────────────++async function submit() {+ if (state.submitting) return;+ if (!state.name.trim()) {+ showStep(0);+ validateStep(0);+ return;+ }+ state.submitting = true;+ el.create.setAttribute('aria-busy', 'true');+ el.create.disabled = true;+ el.back.disabled = true;++ try {+ // 1. Resolve the 3D body to a real, owned avatar_id (if any).+ let avatarId = null;+ if (state.model.mode === 'starter' && state.model.starterUrl) {+ setMsg('Adding the 3D body to your library…', '');+ const av = await saveRemoteGlbToAccount(state.model.starterUrl, {+ source: 'import',+ name: state.name.trim(),+ source_meta: { provider: 'starter-library', source_url: state.model.starterUrl },+ visibility: 'public',+ });+ avatarId = av?.id || null;+ } else if (state.model.mode === 'upload' && state.model.file) {+ setMsg('Uploading your 3D model…', '');+ const av = await saveRemoteGlbToAccount(state.model.file, {+ source: 'upload',+ name: state.model.fileName || state.name.trim(),+ visibility: 'public',+ });+ avatarId = av?.id || null;+ }++ // 2. Create the agent identity.+ setMsg('Creating your agent…', '');+ const createBody = {+ name: state.name.trim(),+ description: state.description.trim() || undefined,+ skills: [...state.skills],+ avatar_id: avatarId || undefined,+ meta: {+ created_via: 'wizard',+ ...(state.greeting.trim() ? { greeting: state.greeting.trim() } : {}),+ ...(state.voice ? { voice_preference: state.voice } : {}),+ ...(state.tags.length ? { wizard_tags: state.tags } : {}),+ },+ };+ const createRes = await apiFetch('/api/agents', {+ method: 'POST',+ headers: { 'Content-Type': 'application/json' },+ body: JSON.stringify(createBody),+ });+ const createData = await createRes.json().catch(() => ({}));+ if (!createRes.ok) {+ if (createRes.status === 409) {+ // Identity conflict — send them back to rename.+ state.submitting = false;+ resetSubmitButton();+ showStep(0);+ const nameEl = $('f-name');+ nameEl.classList.add('is-invalid');+ nameEl.focus();+ setMsg(+ createData.error_description || 'That identity conflicts with an existing agent. Try a different name.',+ 'err',+ );+ return;+ }+ throw new Error(createData.error_description || createData.error || `Create failed (${createRes.status})`);+ }+ const agent = createData.agent;+ if (!agent?.id) throw new Error('Create succeeded but no agent was returned.');++ // 3. Personality + marketplace listing. Publish writes the system prompt,+ // greeting, category, and tags to the real columns and lists the agent.+ // Only attempted when the user opted in AND supplied what publish needs.+ const canPublish = state.publish && state.category && state.persona.trim();+ if (canPublish) {+ setMsg('Publishing to the marketplace…', '');+ try {+ const pubRes = await apiFetch(`/api/marketplace/agents/${agent.id}/publish`, {+ method: 'POST',+ headers: { 'Content-Type': 'application/json' },+ body: JSON.stringify({+ category: state.category,+ tags: state.tags,+ system_prompt: state.persona.trim(),+ greeting: state.greeting.trim() || undefined,+ }),+ });+ if (!pubRes.ok) {+ const pj = await pubRes.json().catch(() => ({}));+ // Non-fatal: the agent exists. Surface a soft warning on success.+ log.warn('[create-agent] publish failed', pj);+ agent._publishWarning = pj.error_description || 'Created, but listing on the marketplace failed — you can publish from the editor.';+ } else {+ agent._published = true;+ }+ } catch (err) {+ log.warn('[create-agent] publish error', err);+ agent._publishWarning = 'Created, but listing on the marketplace failed — you can publish from the editor.';+ }+ }++ succeed(agent);+ } catch (err) {+ log.error('[create-agent] submit failed', err);+ state.submitting = false;+ resetSubmitButton();+ setMsg(err.message || 'Something went wrong. Please try again.', 'err');+ }+}++function resetSubmitButton() {+ el.create.removeAttribute('aria-busy');+ el.create.disabled = false;+ el.back.disabled = false;+}++function succeed(agent) {+ // Swap the form body for the success state.+ el.panels.forEach((p) => p.classList.remove('is-active'));+ el.foot.style.display = 'none';+ $('stepper').style.display = 'none';+ el.success.classList.add('show');++ $('success-title').textContent = `${agent.name} is ready`;+ const sub = agent._published+ ? 'It now has its own wallet and on-chain identity, and it’s live on the marketplace.'+ : agent._publishWarning ||+ 'It now has its own wallet and on-chain identity. Open it to chat, customize, or share.';+ $('success-sub').textContent = sub;++ const open = $('success-open');+ open.href = agent.home_url || `/agent/${agent.id}`;+ $('success-edit').href = `/agent/${agent.id}/edit`;++ // Show the 3D body if it's publicly readable.+ const modelUrl = agent.avatar_model_url;+ if (modelUrl) {+ const box = $('success-preview');+ box.hidden = false;+ const mv = document.createElement('model-viewer');+ mv.setAttribute('src', modelUrl);+ mv.setAttribute('alt', `${agent.name} 3D model`);+ mv.setAttribute('auto-rotate', '');+ mv.setAttribute('auto-rotate-delay', '0');+ mv.setAttribute('rotation-per-second', '20deg');+ mv.setAttribute('interaction-prompt', 'none');+ mv.setAttribute('disable-zoom', '');+ mv.setAttribute('shadow-intensity', '0.4');+ mv.setAttribute('exposure', '0.95');+ mv.setAttribute('environment-image', 'neutral');+ mv.setAttribute('camera-orbit', '15deg 80deg auto');+ box.appendChild(mv);+ }+ el.body.scrollIntoView({ behavior: 'smooth', block: 'start' });+}++// ── Helpers ─────────────────────────────────────────────────────────────────++function setMsg(text, kind) {+ el.footMsg.textContent = text;+ el.footMsg.className = 'foot-msg' + (kind ? ' ' + kind : '');+}+function clearMsg() {+ setMsg('', '');+}+function escapeHtml(s) {+ return String(s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);+}+function truncate(s, n) {+ const t = String(s);+ return t.length > n ? t.slice(0, n - 1).trimEnd() + '…' : t;+}++boot();diff --git a/src/game/community-net.js b/src/game/community-net.jsindex 00c463526..daa15db6e 100644--- a/src/game/community-net.js+++ b/src/game/community-net.js@@ -383,10 +383,13 @@ export class CommunityNet {equip(slot) { this.room?.send('equip', { slot }); }consume(ref) { this.room?.send('consume', { slot: ref }); }requestProfile() { this.room?.send('profileReq'); }- // Update the stored play pass so the next reconnect (after a drop) uses the- // refreshed credential. Does not affect the live session — the server already- // authenticated this connection; the new pass is only needed for re-joins.- updatePlayPass(pass) { this.playPass = pass || ''; }+ // Adopt a refreshed play pass. Store it so the next reconnect (after a drop)+ // uses the fresh credential, AND push it to the live session so the server can+ // extend this connection's bound expiry — otherwise the server's per-minute+ // sweep evicts a still-qualifying player at the original 10-min TTL (which+ // stranded anyone in a long building session). The server re-verifies the pass+ // against the gate before extending; a forged or below-floor pass is ignored.+ updatePlayPass(pass) { this.playPass = pass || ''; if (pass) this.room?.send('play-pass', { playPass: pass }); }get state() { return this.room?.state ?? null; }diff --git a/src/nich-agent.js b/src/nich-agent.jsindex 72204577b..ef1ffc5f1 100644--- a/src/nich-agent.js+++ b/src/nich-agent.js@@ -552,9 +552,20 @@ export class NichAgent {}break;case 'setBgColor':- if (viewer && typeof action.value === 'string') {- viewer.state.bgColor = action.value;- viewer.updateBackground();+ if (typeof action.value === 'string') {+ // On /app the stage keeps the WebGL canvas transparent and paints a+ // backdrop layer behind it, so writing the clear color would be+ // invisible. Drive the backdrop layer when it exists; otherwise fall+ // back to the solid WebGL background on the plain viewer.+ if (document.getElementById('nxt-stage-backdrop')) {+ window.dispatchEvent(+ new CustomEvent('nxt:backdrop', { detail: { value: action.value } }),+ );+ } else if (viewer) {+ viewer.state.bgColor = action.value;+ viewer.state.transparentBg = false;+ viewer.updateBackground();+ }}break;case 'setTransparentBg':@@ -594,6 +605,22 @@ export class NichAgent {viewer.showPumpFunTrades();}break;+ case 'playAnimation': {+ // The LLM emits friendly names ("wave", "dance", "jump"); resolve them+ // against the loaded model's clip library and play immediately.+ const mgr = viewer?.animationManager;+ if (mgr && typeof action.name === 'string') {+ const clip = resolveClipName(action.name, mgr);+ if (clip) {+ mgr.ensureLoaded(clip)+ .then(() => mgr.play(clip))+ .catch((err) => log.warn('[NichAgent] playAnimation failed:', err?.message));+ } else {+ log.warn('[NichAgent] no clip matches animation:', action.name);+ }+ }+ break;+ }default:log.warn('[NichAgent] unknown action:', action.type);}@@ -657,13 +684,34 @@ export class NichAgent {* Returns null if no skill matches.*/_matchSkill(lower) {- if (lower.match(/\b(present|describe|tell me about|what.*model|show me)\b/))- return 'present-model';- if (lower.match(/\b(validate|check|errors|warnings|valid)\b/)) return 'validate-model';- if (lower.match(/\b(remember|save|store|note|don't forget)\b/)) return 'remember';- if (lower.match(/\b(sign|signature|wallet|verify|prove)\b/)) return 'sign-action';- if (lower.match(/\b(think|recall|what do you know|context)\b/)) return 'think';- if (lower.match(/\b(help|what can you|commands|skills|abilities)\b/)) return 'help';+ // Platform / identity questions ("tell me about three.ws", "who are you?") belong to+ // the LLM at /api/chat — it carries the three.ws knowledge base and the agent persona.+ // They must NOT be hijacked by the present-model skill, which only narrates the loaded+ // 3D asset. Generic verbs (tell me about / describe / show me) only mean "present the+ // model" when they actually reference the loaded asset.+ const aboutPlatformOrSelf = /\b(three\.?\s?ws|platform|3d-?agent|yourself|about you|who (are|r) (you|u))\b/.test(lower);+ if (!aboutPlatformOrSelf) {+ const aboutModel = /\b(model|scene|mesh|avatar|geometry|polys?|triangles?|vertices|verts|materials|animations?|clips?|this( one)?|it)\b/;+ if (/^present([- ]model)?$/.test(lower)) return 'present-model';+ if (lower.match(/\b(present|describe|tell me about|show me|what'?s? in)\b/) && aboutModel.test(lower))+ return 'present-model';+ if (lower.match(/\bwhat('?s| is| are)?\b[^?]*\bmodel\b/)) return 'present-model';+ if (lower.match(/\bhow many\b[^?]*\b(vertices|verts|meshes|materials|polys?|triangles?|clips?|animations?)\b/))+ return 'present-model';+ }+ // Explicit glTF validation only — not conversational "is this valid?".+ if (lower.match(/\b(validate|run validation)\b/) || lower.match(/\b(gltf|glb)\b[^?]*\b(errors?|warnings?)\b/))+ return 'validate-model';+ // Persist a memory — imperative "remember/note that …" only, so a casual+ // "do you remember me?" reaches the LLM instead of silently storing nothing.+ if (lower.match(/^(remember|note|don't forget)\b/) || lower.match(/\b(remember|note) (that|this)\b/))+ return 'remember';+ // Wallet signing — needs an explicit sign command. Plain "wallet"/"verify"+ // is conversational and belongs to the LLM (which knows the agent holds a+ // Solana wallet and can act through tools).+ if (lower.match(/\b(sign)\b[^?]*\b(action|message|this|it)\b/)) return 'sign-action';+ // Everything else — identity, capabilities, platform questions, smalltalk —+ // flows to /api/chat for a real Groq/OpenRouter answer.return null;}@@ -714,6 +762,9 @@ export class NichAgent {if (lower.match(/\b(performance|fps|stats)\b/)) {return 'Open the Performance folder in the controls panel for live FPS/MS/MB stats.';}+ if (/\b(three\.?\s?ws|platform|what is this|about (this )?(site|platform|project))\b/.test(lower)) {+ return 'three.ws is the platform for building, embedding, and monetising 3D AI agents. Turn a selfie into a photorealistic 3D avatar in ~60s, embed it on any site with <agent-3d>, give it voice, memory and tools, and let it earn via x402 micropayments. Browse live agents at three.ws/agents.';+ }if (lower.match(/\b(who|what).*(you|this|agent)\b/)) {return `I'm ${this.identity?.name || 'three.ws'} — present, embodied, and here to help with your 3D work.`;}@@ -801,6 +852,43 @@ export class NichAgent {}}+// Common synonyms the LLM reaches for that don't match a manifest clip 1:1.+const CLIP_ALIASES = {+ waving: 'wave',+ hello: 'wave',+ hi: 'wave',+ dancing: 'dance',+ jumping: 'jump',+ celebrating: 'celebrate',+ cheer: 'celebrate',+ cheering: 'celebrate',+ praying: 'pray',+ flex: 'av-arm-flex',+ flexing: 'av-arm-flex',+ backflip: 'av-back-flip',+ 'back-flip': 'av-back-flip',+};++/**+ * Resolve an LLM-friendly animation name ("wave", "dancing") to an actual clip+ * registered on the loaded model. Returns null when nothing reasonable matches.+ * @param {string} requested+ * @param {{getAnimationDefs:()=>Array<{name:string}>}} mgr+ * @returns {string|null}+ */+function resolveClipName(requested, mgr) {+ const want = String(requested).trim().toLowerCase();+ if (!want) return null;+ const defs = mgr.getAnimationDefs?.() || [];+ const names = defs.map((d) => d.name);+ if (names.includes(want)) return want;+ if (CLIP_ALIASES[want] && names.includes(CLIP_ALIASES[want])) return CLIP_ALIASES[want];+ if (names.includes(`av-${want}`)) return `av-${want}`;+ // Loose contains-match — "shuffle" → "av-dance-shuffle".+ const partial = names.find((n) => n.includes(want) || want.includes(n.replace(/^av-/, '')));+ return partial || null;+}+function _escapeHTML(s) {return String(s ?? '').replace(/&/g, '&')diff --git a/vercel.json b/vercel.jsonindex 86da41167..fb57f0cff 100644--- a/vercel.json+++ b/vercel.json@@ -2544,6 +2544,14 @@"src": "/create/","dest": "/create.html"},+ {+ "src": "/create-agent",+ "dest": "/create-agent.html"+ },+ {+ "src": "/create-agent/",+ "dest": "/create-agent.html"+ },{"src": "/creating","dest": "/creating.html"diff --git a/vite.config.js b/vite.config.jsindex d8b4bba58..cb2b5d498 100644--- a/vite.config.js+++ b/vite.config.js@@ -249,6 +249,7 @@ const appConfig = {launchpad: resolve(__dirname, 'pages/launchpad.html'),start: resolve(__dirname, 'pages/start.html'),create: resolve(__dirname, 'pages/create.html'),+ 'create-agent': resolve(__dirname, 'pages/create-agent.html'),forge: resolve(__dirname, 'pages/forge.html'),'create-selfie': resolve(__dirname, 'pages/create-selfie.html'),scan: resolve(__dirname, 'pages/scan.html'),@@ -493,6 +494,7 @@ const appConfig = {'/start': resolve(root, 'pages/start.html'),'/start/': resolve(root, 'pages/start.html'),'/create': resolve(root, 'pages/create.html'),+ '/create-agent': resolve(root, 'pages/create-agent.html'),'/create/selfie': resolve(root, 'pages/create-selfie.html'),'/create/selfie/': resolve(root, 'pages/create-selfie.html'),'/create/video': resolve(root, 'pages/create/video.html'),diff --git a/workers/avatar-pipeline-controller/cloudbuild.yaml b/workers/avatar-pipeline-controller/cloudbuild.yamlindex 80357ff67..aff43b754 100644--- a/workers/avatar-pipeline-controller/cloudbuild.yaml+++ b/workers/avatar-pipeline-controller/cloudbuild.yaml@@ -1,5 +1,6 @@substitutions:_REGION: us-central1+ _RUN_SA: avatar-reconstruction-sa@aerial-vehicle-466722-p5.iam.gserviceaccount.com_SERVICE: avatar-pipeline-controller_REPO: avatar-pipeline-controller_GCS_BUCKET: three-ws-avatar-reconstructions@@ -36,6 +37,7 @@ steps:- ${_SERVICE}- --image=${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server:$SHORT_SHA- --region=${_REGION}+ - --service-account=${_RUN_SA}- --platform=managed- --port=8080# CPU-only — no GPU needed for orchestration.diff --git a/workers/deploy/deploy-all.sh b/workers/deploy/deploy-all.shindex 2b71a75ce..dba293854 100755--- a/workers/deploy/deploy-all.sh+++ b/workers/deploy/deploy-all.sh@@ -64,7 +64,11 @@ gcloud services enable \ok "APIs enabled"PROJECT_NUMBER="$(gcloud projects describe "$PROJECT_ID" --format='value(projectNumber)')"-COMPUTE_SA="${PROJECT_NUMBER}[email protected]"+# Build + runtime identity. Hardened orgs (like this project) have NO default+# compute service account, so we use one explicit SA for both building and+# running. Override via RUN_SA / BUILD_SA if your project differs.+RUN_SA="${RUN_SA:-avatar-reconstruction-sa@${PROJECT_ID}.iam.gserviceaccount.com}"+BUILD_SA="${BUILD_SA:-$RUN_SA}"# ── 2. buckets ────────────────────────────────────────────────────────────────for b in "$OUTPUT_BUCKET" "$WEIGHTS_BUCKET"; do@@ -99,14 +103,21 @@ elseok "created secret $SECRET_NAME"fi-# ── 5. IAM for the Cloud Run runtime service account ──────────────────────────-log "granting runtime roles to $COMPUTE_SA…"-for role in roles/secretmanager.secretAccessor roles/datastore.user roles/storage.objectAdmin; do+# ── 5. IAM for the build + runtime service account ────────────────────────────+log "ensuring $RUN_SA has the needed build + runtime roles…"+for role in roles/secretmanager.secretAccessor roles/datastore.user roles/storage.objectAdmin \+ roles/run.admin roles/artifactregistry.writer roles/logging.logWriter \+ roles/cloudbuild.builds.builder; dogcloud projects add-iam-policy-binding "$PROJECT_ID" \- --member="serviceAccount:${COMPUTE_SA}" --role="$role" --condition=None >/dev/null 2>&1 \- || warn "could not grant $role to $COMPUTE_SA (may already be bound or need an admin)"+ --member="serviceAccount:${RUN_SA}" --role="$role" --condition=None >/dev/null 2>&1 \+ || warn "could not grant $role to $RUN_SA (may already be bound or need an admin)"done-ok "runtime IAM configured"+# The build runs AS this SA and deploys Cloud Run with it as the runtime SA, so+# it must be permitted to actAs itself.+gcloud iam service-accounts add-iam-policy-binding "$RUN_SA" \+ --member="serviceAccount:${RUN_SA}" --role="roles/iam.serviceAccountUser" --condition=None >/dev/null 2>&1 \+ || warn "could not grant actAs-self to $RUN_SA"+ok "build + runtime IAM configured"# ── 6. Artifact Registry repos + build/deploy each GPU service ────────────────declare -A SERVICE_URL@@ -126,7 +137,9 @@ build_and_deploy() {gcloud builds submit \--config "$dir/cloudbuild.yaml" \--region "$REGION" \- --substitutions="SHORT_SHA=${TAG},_REGION=${REGION},_GCS_BUCKET=${OUTPUT_BUCKET},_WEIGHTS_BUCKET=${WEIGHTS_BUCKET}" \+ --service-account="projects/${PROJECT_ID}/serviceAccounts/${BUILD_SA}" \+ --default-buckets-behavior=regional-user-owned-bucket \+ --substitutions="SHORT_SHA=${TAG},_REGION=${REGION},_GCS_BUCKET=${OUTPUT_BUCKET},_WEIGHTS_BUCKET=${WEIGHTS_BUCKET},_RUN_SA=${RUN_SA}" \. \|| die "build/deploy failed for $runname — inspect the Cloud Build log above"@@ -147,7 +160,9 @@ log "building + deploying controller (avatar-pipeline-controller, CPU)…"gcloud builds submit \--config "workers/avatar-pipeline-controller/cloudbuild.yaml" \--region "$REGION" \- --substitutions="SHORT_SHA=${TAG},_REGION=${REGION},_GCS_BUCKET=${OUTPUT_BUCKET}" \+ --service-account="projects/${PROJECT_ID}/serviceAccounts/${BUILD_SA}" \+ --default-buckets-behavior=regional-user-owned-bucket \+ --substitutions="SHORT_SHA=${TAG},_REGION=${REGION},_GCS_BUCKET=${OUTPUT_BUCKET},_RUN_SA=${RUN_SA}" \. \|| die "controller build/deploy failed"diff --git a/workers/deploy/stage-weights.sh b/workers/deploy/stage-weights.shindex 505ef5f50..3cb907778 100755--- a/workers/deploy/stage-weights.sh+++ b/workers/deploy/stage-weights.sh@@ -60,8 +60,15 @@ if ! python3 -c "import huggingface_hub, sys; v=tuple(map(int,huggingface_hub.__log "installing/upgrading huggingface_hub…"pip install --quiet --upgrade "huggingface_hub[cli]>=0.23"fi-HF_CLI="huggingface-cli"-command -v "$HF_CLI" >/dev/null 2>&1 || HF_CLI="python3 -m huggingface_hub.commands.huggingface_cli"+# Newer huggingface_hub ships the `hf` CLI and the legacy `huggingface-cli`+# is a deprecated no-op, so prefer `hf` and fall back only if it's missing.+if command -v hf >/dev/null 2>&1; then+ HF_CLI="hf"+elif command -v huggingface-cli >/dev/null 2>&1; then+ HF_CLI="huggingface-cli"+else+ HF_CLI="python3 -m huggingface_hub.cli"+fi[ -n "${HF_TOKEN:-}" ] && export HF_TOKEN# Ensure the weights bucket exists.@@ -104,6 +111,10 @@ stage_one() {$HF_CLI download "$repo" --local-dir "$target" ${HF_TOKEN:+--token "$HF_TOKEN"}log "${svc}: uploading → ${dest}"gcloud storage rsync --recursive --delete-unmatched-destination-objects "$target" "$dest"+ # Free the local copy immediately so peak disk stays ~one model, not the+ # whole fleet — lets staging run on a bounded-disk host.+ rm -rf "$target"+ log "${svc}: freed local scratch ${target}"elsetarget="${MOUNT_DIR}/${subdir}"log "${svc}: downloading ${repo} straight into bucket (${dest}) — this is the slow step"diff --git a/workers/model-hunyuan3d/cloudbuild.yaml b/workers/model-hunyuan3d/cloudbuild.yamlindex 2517db9b2..634a6a354 100644--- a/workers/model-hunyuan3d/cloudbuild.yaml+++ b/workers/model-hunyuan3d/cloudbuild.yaml@@ -1,5 +1,6 @@substitutions:_REGION: us-central1+ _RUN_SA: avatar-reconstruction-sa@aerial-vehicle-466722-p5.iam.gserviceaccount.com_SERVICE: model-hunyuan3d_REPO: model-hunyuan3d_GCS_BUCKET: three-ws-avatar-reconstructions@@ -37,6 +38,7 @@ steps:- ${_SERVICE}- --image=${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server:$SHORT_SHA- --region=${_REGION}+ - --service-account=${_RUN_SA}- --platform=managed- --port=8080- --gpu=1diff --git a/workers/model-trellis/cloudbuild.yaml b/workers/model-trellis/cloudbuild.yamlindex 6afa12d1d..60c740360 100644--- a/workers/model-trellis/cloudbuild.yaml+++ b/workers/model-trellis/cloudbuild.yaml@@ -1,5 +1,6 @@substitutions:_REGION: us-central1+ _RUN_SA: avatar-reconstruction-sa@aerial-vehicle-466722-p5.iam.gserviceaccount.com_SERVICE: model-trellis_REPO: model-trellis_GCS_BUCKET: three-ws-avatar-reconstructions@@ -37,6 +38,7 @@ steps:- ${_SERVICE}- --image=${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server:$SHORT_SHA- --region=${_REGION}+ - --service-account=${_RUN_SA}- --platform=managed- --port=8080- --gpu=1diff --git a/workers/model-triposr/cloudbuild.yaml b/workers/model-triposr/cloudbuild.yamlindex 8851f7d43..2b49ee4cd 100644--- a/workers/model-triposr/cloudbuild.yaml+++ b/workers/model-triposr/cloudbuild.yaml@@ -1,5 +1,6 @@substitutions:_REGION: us-central1+ _RUN_SA: avatar-reconstruction-sa@aerial-vehicle-466722-p5.iam.gserviceaccount.com_SERVICE: model-triposr_REPO: model-triposr_GCS_BUCKET: three-ws-avatar-reconstructions@@ -37,6 +38,7 @@ steps:- ${_SERVICE}- --image=${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server:$SHORT_SHA- --region=${_REGION}+ - --service-account=${_RUN_SA}- --platform=managed- --port=8080- --gpu=1diff --git a/workers/unirig/cloudbuild.yaml b/workers/unirig/cloudbuild.yamlindex 6f377c025..cd0e29de2 100644--- a/workers/unirig/cloudbuild.yaml+++ b/workers/unirig/cloudbuild.yaml@@ -1,5 +1,6 @@substitutions:_REGION: us-central1+ _RUN_SA: avatar-reconstruction-sa@aerial-vehicle-466722-p5.iam.gserviceaccount.com_SERVICE: unirig_REPO: unirig_GCS_BUCKET: three-ws-avatar-reconstructions@@ -37,6 +38,7 @@ steps:- ${_SERVICE}- --image=${_REGION}-docker.pkg.dev/$PROJECT_ID/${_REPO}/server:$SHORT_SHA- --region=${_REGION}+ - --service-account=${_RUN_SA}- --platform=managed- --port=8080- --gpu=1