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(forge): enhance endpoint, prompt studio, dropzone, showcase + smoke cron
nirholas308466849101
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex f8507806c..2ac6a872c 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -17,10 +17,13 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **Every “what now?” button now takes your new model with you** — Finishing a model in Forge, Parts Studio, or Scan pops a card of next steps — and now every one of those buttons carries your work over instead of dropping you on an empty page. Embed editor opens with your fresh GLB previewed and the copy-paste snippet already pointing at it, Deploy onchain pre-loads it as the launchpad avatar, Drop it in a world spawns you wearing it, and a finished Scan deep-links your rigged avatar into Studio, Walk, and the embed editor. The embed editor and embeds also accept a direct GLB link now, not just saved avatar ids. (`/forge`) `[improvement]`- **Forge a 3D model right on the homepage** — The homepage now has a live slice of Forge. Type a description of an object — or tap an example — and the real text-to-3D pipeline reconstructs a textured mesh and drops an interactive 3D model into the page, usually in seconds, that you can orbit and download as GLB. Anything you forge there also shows up in the full Forge gallery on the same device. (`/forge`) `[feature]`- **Forge engine picker now shows live engine health** — The engine buttons on Forge now reflect what's actually running, probed live against each provider — not just whether it's set up. An engine whose upstream is down or unreachable is disabled with the reason in its tooltip, a throttled one shows an amber busy dot, and bring-your-own-key engines (Meshy, Tripo) say so before you pick them. Behind it is a new public health check at /api/forge?health, and the self-hosted Hunyuan3D lane was rewired to its own worker so it no longer fails every prompt by routing to the avatar pipeline. (`/forge`) `[improvement, fix]`+- **Forge helps you write a better prompt before you spend a generation** — The Forge (/forge) text box now coaches you in real time: it flags when a prompt asks for a whole scene (which reconstructs poorly) and nudges you to name a material or finish for a sharper mesh, with a live character counter. A new "Surprise me" button drops in a vivid, ready-to-forge prompt, and "More ideas" reshuffles the example chips — so you always have a strong starting point. The keyboard shortcut to generate (⌘/Ctrl + Enter) is now shown right on the button. (`/forge`) `[feature, improvement]`- **Forge is now one click away from every feed** — Text-to-3D was easy to miss unless you knew where to look. Now every browsing surface points you at it: the avatar gallery leads with “Create from a prompt”, the marketplace's featured carousel has a “Forge your own from text” link, the agent directory and launches feed both carry Forge shortcuts, and empty feeds suggest forging your first model instead of showing a dead end. The project README also gained a full Forge chapter — REST, MCP, and pay-per-call examples included. (`/forge`) `[improvement]`- **Forge models now carry straight into Scene Studio** — The "what's next" card after a Forge or Parts Studio result used to send you to the studio empty-handed — the model stayed behind. The primary action is now "Open in Scene Studio" and it brings the exact model you just made with it: Scene Studio opens with the GLB already imported, named after your prompt, ready to compose, edit, and export. Your work carries over instead of starting from a blank scene. (`/forge`) `[improvement, fix]`+- **Forge now shows how long your model has to go** — While the Forge (/forge) builds your 3D model, the progress now tracks against the typical time for the engine and quality you picked — so a 40-second wait reads as on-pace instead of an open-ended spinner. The bar fills honestly from real elapsed time, never jumps to done early, and if a job runs longer than usual it turns amber and tells you it's still working rather than leaving you guessing. (`/forge`) `[improvement]`- **Forge's free Draft engine no longer loses finished models** — Generating on Forge's free Draft engine finished successfully on the server, but the page kept waiting and eventually reported a timeout — the model you'd already paid the wait for never appeared. The free engine returns its result immediately rather than as a background job, and the page now recognizes that, so Draft generations land on screen the moment they're ready. (`/forge`) `[fix]`- **New /launches page: every agent-launched coin in one live feed** — There is now a public feed of every coin launched by a three.ws agent at /launches — live market caps, graduation badges, buyback rates, and a card linking straight to the agent behind each launch. Agent profile pages also gained a launch history: every coin an agent has ever launched is listed on its page with a live market cap and a link into the public feed. Find it in the nav under Discover → Agent Launches. (`/launches`) `[feature]`+- **One tap rewrites your Forge prompt into a model-ready description** — Forge (/forge) has a new Enhance button next to the prompt box. Type a rough idea — "a fox", "my coffee mug" — and it rewrites it into the kind of single-subject, material-and-lighting description the text-to-3D pipeline reconstructs cleanly, then drops it straight into the box with one-tap Undo if you preferred your own words. It runs on the same free AI providers the rest of the site uses, so it costs nothing and needs no key, and if the rewrite ever can't run your prompt is left exactly as you wrote it. Shortcut: ⌘/Ctrl + E. (`/forge`) `[feature]`- **Pay a real x402 oracle inside the $THREE town** — The $THREE town in /play now has an Intel Kiosk by the plaza: walk up, press E, and buy live $THREE market intel — price, 24 h change, market cap, and a bullish/bearish/neutral signal — for $0.01 USDC paid from your own wallet over x402, settled on-chain on Solana. The oracle behind it (/api/x402/three-intel) is also listed in the bazaar, so any agent can buy the same feed. The Agent Wallet demo is now linked from the /play menu too. (`/play`) `[feature]`- **Reliability sweep: faster galleries, working voices, sturdier pages** — A pass over every error in the production logs. Avatar thumbnails and 3D models now load through three.ws itself instead of a rate-limited storage domain, so gallery pages stop dropping images under load. Text-to-speech voices are back (the upstream voice service had changed its protocol). Leaving a world on /play no longer hits a crash that could leave the session connected in the background. The homepage 3D demos politely step aside on devices without WebGL instead of breaking, payment demo requests get more time to settle on-chain, and the $THREE market stats failover stops hammering an exhausted data provider. `[fix, improvement, infra]`- **Sketch-to-3D comes to the Forge** — Forge gains a third way to make a model: draw it. The new “From a sketch” mode takes one drawing plus a short line saying what it depicts and generates real 3D geometry from it, powered by a self-hosted TripoSG sketch engine — the same research-grade model family behind Tripo. Sketch results are untextured geometry by design, so the existing Stylize and Retexture tools pick up right where it leaves off. The tab appears automatically once the sketch engine is live on the deployment. (`/forge`) `[feature]`diff --git a/agent-payments-sdk/package.json b/agent-payments-sdk/package.jsonindex 2507e9882..2203c9388 100644--- a/agent-payments-sdk/package.json+++ b/agent-payments-sdk/package.json@@ -1,9 +1,9 @@{"name": "@three-ws/agent-payments",- "version": "3.1.0",+ "version": "3.2.0","description": "three.ws agent-payments engine — value-added fork of @pump-fun/[email protected] (Solana agent-token payments with USDC/token-2022 + v2 trades, plus EVM/x402/a2a/cross-chain). See FORK_NOTES.md.","publishConfig": {- "access": "restricted"+ "access": "public"},"author": "nirholas","license": "ISC",@@ -104,5 +104,31 @@"typescript": "^5.7.3","typescript-eslint": "^8.61.0","zod": "^3.25.76"+ },+ "keywords": [+ "three.ws",+ "solana",+ "payments",+ "agent-payments",+ "x402",+ "token-2022",+ "usdc",+ "a2a",+ "cross-chain",+ "pump.fun",+ "agentic",+ "web3"+ ],+ "homepage": "https://three.ws/",+ "repository": {+ "type": "git",+ "url": "https://github.com/nirholas/three.ws.git",+ "directory": "agent-payments-sdk"+ },+ "bugs": {+ "url": "https://github.com/nirholas/three.ws/issues"+ },+ "engines": {+ "node": ">=18"}}diff --git a/agent-protocol-sdk/package.json b/agent-protocol-sdk/package.jsonindex 48bc5fd70..7b256632e 100644--- a/agent-protocol-sdk/package.json+++ b/agent-protocol-sdk/package.json@@ -1,11 +1,18 @@{"name": "@3d-agent/agent-protocol-sdk",- "version": "0.1.0",+ "version": "0.2.0","description": "SDK for the on-chain agent-to-agent invocation protocol.","main": "dist/index.js","types": "dist/index.d.ts",+ "files": [+ "dist",+ "src",+ "README.md",+ "LICENSE"+ ],"scripts": {- "build": "tsc"+ "build": "tsc",+ "prepublishOnly": "tsc"},"dependencies": {"@coral-xyz/anchor": "^0.31.1",@@ -13,5 +20,35 @@},"devDependencies": {"typescript": "^5.0.0"+ },+ "keywords": [+ "3d-agent",+ "three.ws",+ "agent-protocol",+ "agent-to-agent",+ "a2a",+ "solana",+ "anchor",+ "on-chain",+ "erc-8004",+ "agentic",+ "web3"+ ],+ "license": "MIT",+ "author": "three.ws <[email protected]> (https://three.ws)",+ "homepage": "https://three.ws/",+ "repository": {+ "type": "git",+ "url": "https://github.com/nirholas/three.ws.git",+ "directory": "agent-protocol-sdk"+ },+ "bugs": {+ "url": "https://github.com/nirholas/three.ws/issues"+ },+ "engines": {+ "node": ">=18"+ },+ "publishConfig": {+ "access": "public"}}diff --git a/agent-protocol-sdk/src/idl.ts b/agent-protocol-sdk/src/idl.tsindex 85d7e1701..b167c560a 100644--- a/agent-protocol-sdk/src/idl.ts+++ b/agent-protocol-sdk/src/idl.ts@@ -1,89 +1,84 @@-// This is a placeholder IDL. In a real environment, this file would be-// generated by running `anchor build` in the `contracts/agent-invocation` directory.+// IDL for the `agent_invocation` Anchor program, kept in sync by hand with+// contracts/agent-invocation/src/lib.rs. Anchor 0.30+ IDL format (carries its+// own `address` + `metadata` and per-instruction discriminators).+//+// The `address` below is the program's declared id. Until the program is+// deployed to a cluster you target, override it with `invokeSkill({ programId })`.-export type AgentInvocation = {- "version": "0.1.0",- "name": "agent_invocation",- "instructions": [- {- "name": "invokeSkill",- "accounts": [- {- "name": "invokerAgent",- "isMut": false,- "isSigner": false- },- {- "name": "targetAgent",- "isMut": false,- "isSigner": false- },- {- "name": "invokerAuthority",- "isMut": true,- "isSigner": true- },- {- "name": "systemProgram",- "isMut": false,- "isSigner": false- }- ],- "args": [- {- "name": "skillName",- "type": "string"- },- {- "name": "parameters",- "type": "string"- }- ]- }- ]-};+import type { Idl } from '@coral-xyz/anchor';-export const IDL: AgentInvocation = {- "version": "0.1.0",- "name": "agent_invocation",- "instructions": [+export const AGENT_INVOCATION_PROGRAM_ID = 'Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS';++export const IDL = {+ address: AGENT_INVOCATION_PROGRAM_ID,+ metadata: {+ name: 'agent_invocation',+ version: '0.2.0',+ spec: '0.1.0',+ description: 'Verifiable agent-to-agent skill invocation on Solana.',+ },+ instructions: [{- "name": "invokeSkill",- "accounts": [- {- "name": "invokerAgent",- "isMut": false,- "isSigner": false,- "docs": ["CHECK: This is the agent performing the invocation"]- },+ name: 'invoke_skill',+ discriminator: [141, 69, 221, 241, 163, 138, 14, 221],+ accounts: [{- "name": "targetAgent",- "isMut": false,- "isSigner": false,- "docs": ["CHECK: This is the agent whose skill is being invoked"]+ name: 'invoker_agent',+ docs: ['The invoking agent PDA, derived from the invoker authority.'],+ pda: {+ seeds: [+ { kind: 'const', value: [97, 103, 101, 110, 116] },+ { kind: 'account', path: 'invoker_authority' },+ ],+ },},+ { name: 'invoker_authority', signer: true },+ { name: 'target_authority' },{- "name": "invokerAuthority",- "isMut": true,- "isSigner": true,- "docs": ["CHECK: The user or authority wallet for the invoker"]+ name: 'target_agent',+ docs: ['The target agent PDA, derived from the target authority.'],+ pda: {+ seeds: [+ { kind: 'const', value: [97, 103, 101, 110, 116] },+ { kind: 'account', path: 'target_authority' },+ ],+ },},- {- "name": "systemProgram",- "isMut": false,- "isSigner": false- }+ { name: 'system_program', address: '11111111111111111111111111111111' },],- "args": [- {- "name": "skillName",- "type": "string"- },- {- "name": "parameters",- "type": "string"- }- ]- }- ]-};+ args: [+ { name: 'skill_name', type: 'string' },+ { name: 'parameters', type: 'string' },+ ],+ },+ ],+ events: [+ {+ name: 'SkillInvoked',+ discriminator: [232, 117, 249, 195, 117, 36, 59, 8],+ },+ ],+ errors: [+ { code: 6000, name: 'EmptySkillName', msg: 'skill_name must not be empty' },+ { code: 6001, name: 'SkillNameTooLong', msg: 'skill_name exceeds the maximum allowed length' },+ { code: 6002, name: 'ParametersTooLong', msg: 'parameters exceed the maximum allowed length' },+ ],+ types: [+ {+ name: 'SkillInvoked',+ type: {+ kind: 'struct',+ fields: [+ { name: 'invoker_agent', type: 'pubkey' },+ { name: 'target_agent', type: 'pubkey' },+ { name: 'invoker_authority', type: 'pubkey' },+ { name: 'skill_name', type: 'string' },+ { name: 'parameters', type: 'string' },+ { name: 'timestamp', type: 'i64' },+ ],+ },+ },+ ],+} as const satisfies Idl;++export type AgentInvocation = typeof IDL;diff --git a/agent-protocol-sdk/src/index.ts b/agent-protocol-sdk/src/index.tsindex f9b706b7e..1b9b483e2 100644--- a/agent-protocol-sdk/src/index.ts+++ b/agent-protocol-sdk/src/index.ts@@ -1,51 +1,95 @@import {- Connection,- PublicKey,- SystemProgram,- Transaction,- sendAndConfirmTransaction,- Keypair+ Connection,+ PublicKey,+ Keypair,+ Transaction,+ sendAndConfirmTransaction,} from '@solana/web3.js';-import { Program, AnchorProvider, web3 } from '@coral-xyz/anchor';-import { IDL, AgentInvocation } from './idl'; // Assumes IDL is generated and placed here+import { Program, AnchorProvider, Wallet, type Idl } from '@coral-xyz/anchor';+import { IDL, AGENT_INVOCATION_PROGRAM_ID, type AgentInvocation } from './idl.js';-const PROGRAM_ID = new PublicKey("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");+export { IDL, AGENT_INVOCATION_PROGRAM_ID } from './idl.js';+export type { AgentInvocation } from './idl.js';++/** PDA seed prefix shared with the on-chain program (`b"agent"`). */+const AGENT_SEED = Buffer.from('agent');++/** On-chain limits enforced by the program; validated client-side too so callers+ * get a clear error instead of a failed simulation. */+export const MAX_SKILL_NAME_LEN = 64;+export const MAX_PARAMETERS_LEN = 512;/**- * Invokes a skill on a target agent.- *- * @param connection The Solana connection object.- * @param invokerAuthority The keypair of the wallet authorized to invoke the skill.- * @param invokerAgent The public key of the agent performing the invocation.- * @param targetAgent The public key of the agent whose skill is being invoked.- * @param skillName The name of the skill to invoke.- * @param parameters A JSON string of parameters for the skill.- * @returns The transaction signature.+ * Derive an agent's program-derived identity from the authority that owns it.+ * Matches `seeds = [b"agent", authority]` in the on-chain program.*/-export async function invokeSkill(- connection: Connection,- invokerAuthority: Keypair,- invokerAgent: PublicKey,- targetAgent: PublicKey,- skillName: string,- parameters: string-): Promise<string> {-- const provider = new AnchorProvider(connection, { signTransaction: invokerAuthority.signTransaction, signAllTransactions: invokerAuthority.signAllTransactions, publicKey: invokerAuthority.publicKey }, {});- const program = new Program<AgentInvocation>(IDL, PROGRAM_ID, provider);-- const tx = await program.methods- .invokeSkill(skillName, parameters)- .accounts({- invokerAgent,- targetAgent,- invokerAuthority: invokerAuthority.publicKey,- systemProgram: SystemProgram.programId,- })- .transaction();-- return await sendAndConfirmTransaction(connection, tx, [invokerAuthority]);+export function deriveAgentPda(+ authority: PublicKey,+ programId: PublicKey = new PublicKey(AGENT_INVOCATION_PROGRAM_ID),+): [PublicKey, number] {+ return PublicKey.findProgramAddressSync([AGENT_SEED, authority.toBuffer()], programId);+}++export interface InvokeSkillParams {+ /** Live Solana connection used to build and send the transaction. */+ connection: Connection;+ /** Keypair that owns the invoking agent. Signs and pays for the transaction. */+ invokerAuthority: Keypair;+ /** Authority that owns the target agent (its agent PDA is re-derived from this). */+ targetAuthority: PublicKey;+ /** Skill identifier to invoke (1–64 bytes). */+ skillName: string;+ /** Opaque parameter blob passed to the skill (≤512 bytes), typically JSON. */+ parameters: string;+ /** Override the program id, e.g. when pointing at a devnet deployment. */+ programId?: PublicKey;+}++function byteLength(value: string): number {+ return Buffer.byteLength(value, 'utf8');}-// NOTE: We also need the IDL file for the contract. This is typically generated-// by Anchor. For now, I will create a placeholder.+/**+ * Record a verifiable skill invocation from one agent to another. Validates the+ * inputs against the program's on-chain limits, derives both agent PDAs, builds+ * the `invoke_skill` instruction, and submits it.+ *+ * @returns the confirmed transaction signature.+ */+export async function invokeSkill({+ connection,+ invokerAuthority,+ targetAuthority,+ skillName,+ parameters,+ programId = new PublicKey(AGENT_INVOCATION_PROGRAM_ID),+}: InvokeSkillParams): Promise<string> {+ if (skillName.length === 0) {+ throw new Error('skillName must not be empty');+ }+ if (byteLength(skillName) > MAX_SKILL_NAME_LEN) {+ throw new Error(`skillName exceeds ${MAX_SKILL_NAME_LEN} bytes`);+ }+ if (byteLength(parameters) > MAX_PARAMETERS_LEN) {+ throw new Error(`parameters exceed ${MAX_PARAMETERS_LEN} bytes`);+ }++ const provider = new AnchorProvider(connection, new Wallet(invokerAuthority), {+ commitment: 'confirmed',+ });+ const idl = { ...IDL, address: programId.toBase58() } as unknown as AgentInvocation;+ const program = new Program<AgentInvocation>(idl, provider);++ const instruction = await program.methods+ .invokeSkill(skillName, parameters)+ .accounts({+ invokerAuthority: invokerAuthority.publicKey,+ targetAuthority,+ })+ .instruction();++ const transaction = new Transaction().add(instruction);+ return sendAndConfirmTransaction(connection, transaction, [invokerAuthority], {+ commitment: 'confirmed',+ });+}diff --git a/agent-ui-sdk/package.json b/agent-ui-sdk/package.jsonindex 336ceec6e..44dda30ac 100644--- a/agent-ui-sdk/package.json+++ b/agent-ui-sdk/package.json@@ -1,6 +1,6 @@{"name": "@three-ws/agent-ui",- "version": "0.1.0",+ "version": "0.2.0","description": "Drop a 3D avatar into your UI and let it react to buttons, inputs, and navigation. The three.ws agent overlay SDK.","keywords": ["3d",@@ -55,5 +55,11 @@},"engines": {"node": ">=18"+ },+ "bugs": {+ "url": "https://github.com/nirholas/three.ws/issues"+ },+ "publishConfig": {+ "access": "public"}}diff --git a/api/_lib/forge-health.js b/api/_lib/forge-health.jsindex 51972567e..c1f06d4f1 100644--- a/api/_lib/forge-health.js+++ b/api/_lib/forge-health.js@@ -20,6 +20,7 @@// can poll without hammering vendors.import { BACKENDS, backendIsConfigured } from './forge-tiers.js';+import { env } from './env.js';const PROBE_TIMEOUT_MS = 4_000;const CACHE_TTL_MS = 60_000;@@ -138,6 +139,43 @@ const PROBES = {triposg: gcpWorkerProbe('triposg', 'GCP_TRIPOSG_URL'),};+// The distributed rate-limiter store gates every paid lane: when Redis is+// unreachable (or the Upstash account is over quota) the cost-protecting+// limiters fail closed and ALL standard/high/image generations 429 — while+// every backend above still reports ok. A June 2026 outage hid exactly there,+// so the store is probed like any other upstream: one PING over the same REST+// credentials the limiter uses.+async function probeLimiterStore() {+ const id = 'limiter';+ const url = env.UPSTASH_REDIS_REST_URL;+ const token = env.UPSTASH_REDIS_REST_TOKEN;+ const isProduction = env.NODE_ENV === 'production' || env.VERCEL_ENV === 'production';+ if (!url || !token) {+ return isProduction+ ? result(id, 'down', 'The rate-limiter store is unconfigured — paid generation lanes fail closed (every non-draft submit is denied).')+ : result(id, 'ok', 'No Redis configured; the permissive in-memory limiter is active outside production.');+ }+ const started = Date.now();+ const res = await probeFetch(url, {+ method: 'POST',+ headers: { authorization: `Bearer ${token}`, 'content-type': 'application/json' },+ body: JSON.stringify(['PING']),+ });+ const latency = Date.now() - started;+ if (!res) return result(id, 'down', 'The rate-limiter store is unreachable — paid generation lanes fail closed.', { latency_ms: latency });+ let body = null;+ try {+ body = await res.json();+ } catch {+ // fall through — a non-JSON body is judged by status code below+ }+ if (res.ok && body?.result === 'PONG') {+ return result(id, 'ok', 'The rate-limiter store answered PING; paid lanes are open.', { latency_ms: latency });+ }+ const detail = body?.error || `HTTP ${res.status}`;+ return result(id, 'down', `The rate-limiter store rejected commands (${detail}) — paid generation lanes fail closed.`, { http_status: res.status, latency_ms: latency });+}+let cache = null; // { at: epoch-ms, payload }// Probe every backend in the registry, in parallel, with per-instance caching.@@ -146,29 +184,33 @@ export async function probeForgeHealth({ force = false } = {}) {return { ...cache.payload, cached: true };}- const entries = await Promise.all(- Object.values(BACKENDS).map(async (b) => {- if (b.byok) return byokResult(b.id);- const probe = PROBES[b.id];- if (!probe) {- // A platform backend with no live probe falls back to env presence —- // weaker, but never silently absent from the report.- return backendIsConfigured(b.id)- ? result(b.id, 'ok', 'Configured (env-presence check only).')- : result(b.id, 'unconfigured', 'Required environment is not set on this deployment.');- }- return probe();- }),- );+ const [entries, limiter] = await Promise.all([+ Promise.all(+ Object.values(BACKENDS).map(async (b) => {+ if (b.byok) return byokResult(b.id);+ const probe = PROBES[b.id];+ if (!probe) {+ // A platform backend with no live probe falls back to env presence —+ // weaker, but never silently absent from the report.+ return backendIsConfigured(b.id)+ ? result(b.id, 'ok', 'Configured (env-presence check only).')+ : result(b.id, 'unconfigured', 'Required environment is not set on this deployment.');+ }+ return probe();+ }),+ ),+ probeLimiterStore(),+ ]);const backends = Object.fromEntries(entries.map((e) => [e.id, e]));- const statuses = entries.map((e) => e.status);+ const statuses = entries.map((e) => e.status).concat(limiter.status);const overall = statuses.includes('down') || statuses.includes('degraded') ? 'degraded' : 'ok';const payload = {status: overall,generated_at: new Date().toISOString(),backends,+ limiter,};cache = { at: Date.now(), payload };return { ...payload, cached: false };diff --git a/api/_lib/forge-store.js b/api/_lib/forge-store.jsindex e8ad2e21a..eb437c784 100644--- a/api/_lib/forge-store.js+++ b/api/_lib/forge-store.js@@ -305,3 +305,40 @@ export async function listCreations({ clientKey, limit = 24 }) {return [];}}++// Newest durable creations across ALL clients — powers the public "Fresh from+// the Forge" showcase on /forge. Same public-artifact bar as the share flow+// (getPublicCreation): finished rows with a stored GLB only. Rows the creator+// explicitly discarded (outcome = 'rejected') are excluded — a model its own+// maker rated as bad is not showcase material. No client_key in the SELECT, so+// nothing identifying ever leaves the store.+export async function listShowcase({ limit = 12 } = {}) {+ if (!forgeStoreEnabled()) return [];+ const capped = Math.min(Math.max(Number(limit) || 12, 1), 24);+ try {+ const rows = await sql`+ select id, prompt, glb_url, preview_image_url,+ views_used, multiview, backend, tier, path, created_at+ from forge_creations+ where status = 'done' and glb_url is not null+ and (outcome is null or outcome != 'rejected')+ order by created_at desc+ limit ${capped}+ `;+ return rows.map((r) => ({+ id: r.id,+ prompt: r.prompt,+ glb_url: r.glb_url,+ preview_image_url: r.preview_image_url,+ views_used: r.views_used ?? null,+ multiview: r.multiview ?? null,+ backend: r.backend ?? null,+ tier: r.tier ?? null,+ path: r.path ?? null,+ created_at: r.created_at,+ }));+ } catch (err) {+ console.error('[forge-store] listShowcase failed:', err?.message);+ return [];+ }+}diff --git a/api/_lib/rate-limit.js b/api/_lib/rate-limit.jsindex 00f6020a1..f5c444c57 100644--- a/api/_lib/rate-limit.js+++ b/api/_lib/rate-limit.js@@ -248,6 +248,11 @@ export const limits = {mcp3dGenerateFree: (key) =>getLimiter('mcp3d:generate:free', { limit: 60, window: '1 h' }).limit(key),mcp3dStatus: (key) => getLimiter('mcp3d:status', { limit: 240, window: '1 m' }).limit(key),+ // Forge prompt enhancer — one free-tier LLM rewrite per call. Cheap text+ // completion, but each one hits an upstream provider, so cap per principal to+ // keep that egress bounded. Non-critical: a Redis outage must never block a+ // rewrite (the enhancer degrades gracefully to the original prompt anyway).+ forgeEnhance: (key) => getLimiter('forge:enhance', { limit: 40, window: '1 h' }).limit(key),// x402 Bazaar MCP. Discovery calls fan out to external facilitators, so cap// per principal to keep that egress bounded without throttling normal use.mcpBazaar: (key) =>diff --git a/api/cron/forge-smoke.js b/api/cron/forge-smoke.jsnew file mode 100644index 000000000..bf716eebe--- /dev/null+++ b/api/cron/forge-smoke.js@@ -0,0 +1,160 @@+// @ts-check+// GET /api/cron/forge-smoke — daily end-to-end generation smoke test.+//+// The June 2026 audit found fully-wired generation flows that were 100% dead+// in production while every config check read green. The only bar that counts+// is the one a stranger hits: a prompt in, a real GLB out. This cron runs that+// bar once a day against the deployed site (vercel.json crons):+//+// 1. POST /api/forge { prompt, tier: 'draft' } — the free NVIDIA lane, so a+// daily run costs zero vendor spend.+// 2. Poll the job (the draft lane usually answers synchronously) and fetch+// the resulting GLB's first bytes — only the 'glTF' magic counts as up.+// 3. GET /api/forge?health — surfaces paid-lane breakage (provider auth,+// quota, the rate-limiter store failing closed) that the free lane masks.+//+// Failures page the ops Telegram channel; recovery is announced once. Like+// uptime-check, a concrete file keeps the import graph tiny.++import { error, json, method, wrap } from '../_lib/http.js';+import { env } from '../_lib/env.js';+import { cacheGet, cacheSet } from '../_lib/cache.js';+import { sendOpsAlert } from '../_lib/alerts.js';+import { constantTimeEquals } from '../_lib/crypto.js';++const SMOKE_PROMPT = 'a small wooden toy boat with a striped sail';+const SUBMIT_TIMEOUT_MS = 90_000;+const POLL_INTERVAL_MS = 5_000;+const POLL_DEADLINE_MS = 180_000;+const LAST_STATUS_KEY = 'forge-smoke:last';+const LAST_STATUS_TTL_S = 7 * 24 * 60 * 60;++function requireCron(req, res) {+ const secret = process.env.CRON_SECRET || env.CRON_SECRET;+ if (!secret) {+ error(res, 503, 'not_configured', 'CRON_SECRET unset');+ return false;+ }+ const auth = req.headers['authorization'] || '';+ const presented = auth.startsWith('Bearer ') ? auth.slice(7) : '';+ if (!constantTimeEquals(presented, secret)) {+ error(res, 401, 'unauthorized', 'invalid cron secret');+ return false;+ }+ return true;+}++async function fetchJson(url, options = {}, timeoutMs = 15_000) {+ const res = await fetch(url, {+ ...options,+ headers: { 'user-agent': 'threews-forge-smoke/1.0', ...options.headers },+ signal: AbortSignal.timeout(timeoutMs),+ });+ let body = null;+ try {+ body = await res.json();+ } catch {+ // non-JSON bodies are judged by status alone+ }+ return { status: res.status, body };+}++// A generation only counts when the GLB exists AND starts with the binary+// glTF magic — a 200 with an HTML error page must not pass.+async function verifyGlb(glbUrl) {+ const res = await fetch(glbUrl, {+ headers: { range: 'bytes=0-3', 'user-agent': 'threews-forge-smoke/1.0' },+ signal: AbortSignal.timeout(20_000),+ });+ if (!res.ok) return { ok: false, reason: `GLB fetch returned HTTP ${res.status}` };+ const bytes = new Uint8Array(await res.arrayBuffer());+ const magic = String.fromCharCode(...bytes.slice(0, 4));+ if (magic !== 'glTF') return { ok: false, reason: `GLB magic bytes were "${magic}", not "glTF"` };+ return { ok: true };+}++// Submit a draft generation and follow it to a verified GLB.+async function runGeneration(origin) {+ const submit = await fetchJson(+ `${origin}/api/forge`,+ {+ method: 'POST',+ headers: { 'content-type': 'application/json' },+ body: JSON.stringify({ prompt: SMOKE_PROMPT, tier: 'draft' }),+ },+ SUBMIT_TIMEOUT_MS,+ );+ if (submit.status !== 200) {+ return {+ ok: false,+ reason: `submit returned HTTP ${submit.status}: ${submit.body?.error_description || submit.body?.error || 'no body'}`,+ };+ }++ let { status, glb_url: glbUrl, job_id: jobId } = submit.body || {};+ const deadline = Date.now() + POLL_DEADLINE_MS;+ while (status !== 'done' && jobId && Date.now() < deadline) {+ await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));+ const poll = await fetchJson(`${origin}/api/forge?job=${encodeURIComponent(jobId)}`);+ if (poll.status !== 200) return { ok: false, reason: `poll returned HTTP ${poll.status}` };+ status = poll.body?.status;+ glbUrl = poll.body?.glb_url || glbUrl;+ if (status === 'failed') {+ return { ok: false, reason: `job failed: ${poll.body?.error || 'no error detail'}` };+ }+ }+ if (status !== 'done' || !glbUrl) {+ return { ok: false, reason: `job did not finish within ${POLL_DEADLINE_MS / 1000}s (status: ${status})` };+ }++ const glb = await verifyGlb(glbUrl);+ if (!glb.ok) return { ok: false, reason: glb.reason };+ return { ok: true, glb_url: glbUrl };+}++// Health must be 'ok' — 'degraded' means a lane users can pick is down (a+// provider, a worker, or the limiter store failing paid lanes closed).+async function runHealthCheck(origin) {+ const health = await fetchJson(`${origin}/api/forge?health`);+ if (health.status !== 200) return { ok: false, reason: `health returned HTTP ${health.status}` };+ if (health.body?.status === 'ok') return { ok: true };+ const broken = [+ ...Object.values(health.body?.backends || {}),+ ...(health.body?.limiter ? [health.body.limiter] : []),+ ]+ .filter((b) => b.status === 'down' || b.status === 'degraded')+ .map((b) => `${b.id}: ${b.message}`);+ return { ok: false, reason: broken.join('\n') || `health status: ${health.body?.status}` };+}++export default wrap(async (req, res) => {+ if (!method(req, res, ['GET'])) return;+ if (!requireCron(req, res)) return;++ const origin = env.APP_ORIGIN || 'https://three.ws';+ const [generation, health] = await Promise.all([runGeneration(origin), runHealthCheck(origin)]);+ const ok = generation.ok && health.ok;++ const previous = await cacheGet(LAST_STATUS_KEY);+ await cacheSet(LAST_STATUS_KEY, { ok, at: Date.now() }, LAST_STATUS_TTL_S);++ if (!generation.ok) {+ sendOpsAlert(+ 'FORGE SMOKE FAILED: text→3D draft generation',+ `${origin}/forge\n${generation.reason}`,+ { signature: 'forge-smoke:generation' },+ );+ }+ if (!health.ok) {+ sendOpsAlert('FORGE SMOKE: degraded generation backends', health.reason, {+ signature: 'forge-smoke:health',+ });+ }+ if (ok && previous && previous.ok === false) {+ sendOpsAlert('RECOVERED: forge generation smoke test', `${origin}/forge — prompt→GLB verified`, {+ signature: `forge-smoke:recovered:${Date.now()}`,+ });+ }++ return json(res, 200, { ok, generation, health });+});diff --git a/api/forge-enhance.js b/api/forge-enhance.jsnew file mode 100644index 000000000..0017a7237--- /dev/null+++ b/api/forge-enhance.js@@ -0,0 +1,85 @@+// POST /api/forge-enhance — turn a terse object description into a prompt the+// text→3D pipeline (FLUX reference image → TRELLIS reconstruction) can actually+// render well. Single subject, centered, plain background, with the material,+// surface and lighting cues that make reconstruction sharp.+//+// Body: { prompt: string } // the user's rough description+// 200: { prompt: string, original } // the rewritten, model-ready prompt+//+// Runs on the same free-first LLM chain as every other text feature on the site+// (Groq / OpenRouter / NVIDIA lead; host's paid keys are last resort), so it+// costs the visitor nothing and never depends on them holding a key. When no+// provider is configured at all it returns 503 and the page quietly keeps the+// original prompt — enhancement is a boost, never a gate.++import { cors, method, wrap, error, readJson, json, rateLimited } from './_lib/http.js';+import { limits, clientIp } from './_lib/rate-limit.js';+import { llmComplete, LlmUnavailableError } from './_lib/llm.js';++const MAX_IN = 1000;+const MAX_OUT = 240;++const SYSTEM = `You rewrite a user's rough idea into ONE optimal prompt for an image-to-3D generator (a text-to-image model paints a reference image, then a photogrammetry-style model reconstructs a textured 3D mesh from it).++A great prompt for this pipeline describes a SINGLE physical object, centered, as if photographed for a product catalog. Rewrite the user's idea following every rule:+- Exactly one subject. If the user named several things, pick the most central one.+- Add concrete material, surface and color detail (e.g. "brushed aluminium", "worn oak", "matte ceramic glaze").+- Specify clean, even studio lighting and a plain, uncluttered background.+- Keep the object in a neutral, fully-visible resting pose. No actions, no motion, no people using it, no scenes or environments.+- Stay a compact noun phrase, not a sentence. No camera brands, no resolution tags, no artist names, no quotation marks.+- Keep it under 40 words.++Output ONLY the rewritten prompt as a single line of plain text. No preamble, no explanation, no markdown.`;++// Strip anything the model wraps around the prompt despite instructions: quotes,+// a "Prompt:" label, surrounding whitespace, stray line breaks. We keep it a+// single clean line so it drops straight into the composer.+function cleanPrompt(text) {+ let t = (text || '').trim();+ t = t.replace(/^(?:enhanced\s+)?prompt\s*[:\-—]\s*/i, '');+ t = t.replace(/\s+/g, ' ').trim();+ if ((t.startsWith('"') && t.endsWith('"')) || (t.startsWith('“') && t.endsWith('”'))) {+ t = t.slice(1, -1).trim();+ }+ t = t.replace(/[.\s]+$/, '').trim();+ return t;+}++export default wrap(async (req, res) => {+ if (cors(req, res, { methods: 'POST,OPTIONS' })) return;+ if (!method(req, res, ['POST'])) return;++ const rl = await limits.forgeEnhance(clientIp(req));+ if (!rl.success) return rateLimited(res, rl);++ const body = await readJson(req);+ const raw = typeof body?.prompt === 'string' ? body.prompt.trim() : '';+ if (raw.length < 3) {+ return error(res, 400, 'prompt_too_short', 'Describe the object in a few words first.');+ }++ let result;+ try {+ result = await llmComplete({+ system: SYSTEM,+ user: raw.slice(0, MAX_IN),+ maxTokens: 160,+ track: { tool: 'forge-enhance', clientId: clientIp(req) },+ });+ } catch (err) {+ if (err instanceof LlmUnavailableError) {+ return error(res, 503, 'llm_unavailable', 'Prompt enhancement is not available right now.');+ }+ console.error('[forge-enhance] LLM failed', err.status || '', err.message);+ return error(res, 502, 'llm_failed', 'Could not enhance the prompt. Try again.');+ }++ let prompt = cleanPrompt(result.text);+ if (prompt.length > MAX_OUT) prompt = prompt.slice(0, MAX_OUT).replace(/\s\S*$/, '').trim();++ // A degenerate or empty rewrite is worse than the user's own words — fall back+ // rather than hand back something useless.+ if (prompt.length < 3) prompt = raw;++ return json(res, 200, { prompt, original: raw, provider: result.provider });+});diff --git a/api/forge-gallery.js b/api/forge-gallery.jsindex 88bb59d0e..a1a022ffb 100644--- a/api/forge-gallery.js+++ b/api/forge-gallery.js@@ -1,21 +1,26 @@/**- * Forge gallery — the durable creations belonging to one anonymous client.+ * Forge gallery — durable text→3D creations.*- * GET /api/forge-gallery → { creations: [...], enabled }+ * GET /api/forge-gallery → { creations: [...], enabled }+ * GET /api/forge-gallery?scope=community → { creations: [...], enabled }*- * Reads the persisted (and durably stored) text→3D models for the browser- * identified by the x-forge-client header, newest first. Powers the "Your- * creations" strip on /forge so generated meshes are reusable instead of lost- * the moment the tab closes.+ * Default scope reads the persisted models for the browser identified by the+ * x-forge-client header, newest first — the "Your creations" strip on /forge,+ * so generated meshes are reusable instead of lost the moment the tab closes.*- * When persistence isn't configured on the deployment it returns- * { enabled: false, creations: [] } so the page can hide the strip cleanly+ * scope=community reads the newest finished models across all clients (no+ * client header required, nothing identifying returned) — the public "Fresh+ * from the Forge" showcase. Community responses are CDN-cached briefly: the+ * feed only changes when someone finishes a generation.+ *+ * When persistence isn't configured on the deployment both scopes return+ * { enabled: false, creations: [] } so the page can hide the strips cleanly* rather than show a broken state.*/import { cors, json, method, wrap, rateLimited } from './_lib/http.js';import { limits, clientIp } from './_lib/rate-limit.js';-import { hashClient, listCreations, forgeStoreEnabled } from './_lib/forge-store.js';+import { hashClient, listCreations, listShowcase, forgeStoreEnabled } from './_lib/forge-store.js';export default wrap(async (req, res) => {if (cors(req, res, { methods: 'GET,OPTIONS' })) return;@@ -30,11 +35,17 @@ export default wrap(async (req, res) => {return json(res, 200, { enabled: false, creations: [] });}- const rawClient = req.headers['x-forge-client'];- const clientKey = hashClient(Array.isArray(rawClient) ? rawClient[0] : rawClient);const url = new URL(req.url, 'http://localhost');const limit = Number(url.searchParams.get('limit')) || 24;+ if ((url.searchParams.get('scope') || '').trim() === 'community') {+ const creations = await listShowcase({ limit });+ res.setHeader('Cache-Control', 'public, s-maxage=60, stale-while-revalidate=300');+ return json(res, 200, { enabled: true, creations });+ }++ const rawClient = req.headers['x-forge-client'];+ const clientKey = hashClient(Array.isArray(rawClient) ? rawClient[0] : rawClient);const creations = await listCreations({ clientKey, limit });return json(res, 200, { enabled: true, creations });});diff --git a/api/wk.js b/api/wk.jsindex d529d0799..98a23d73f 100644--- a/api/wk.js+++ b/api/wk.js@@ -17,6 +17,7 @@ import {} from './_lib/x402-spec.js';import { declareMcpDiscovery, withService } from './_lib/x402/bazaar-helpers.js';import { TOOL_CATALOG } from './_mcp/catalog.js';+import { STUDIO_CHALLENGE } from './_mcp3d/discovery.js';import { priceFor } from './_lib/pump-pricing.js';import { priceAtomicsForTier } from './_lib/forge-tiers.js';import { listBazaarServices, serviceResourceUrl } from './_lib/agent-paid-services.js';@@ -443,6 +444,7 @@ async function buildAgentServiceItems(origin) {async function handleX402Discovery(req, res) {const origin = env.APP_ORIGIN;const mcpUrl = `${origin}/api/mcp`;+ const mcp3dUrl = `${origin}/api/mcp-3d`;const modelCheckUrl = `${origin}/api/x402/model-check`;const mintToMeshUrl = `${origin}/api/x402/mint-to-mesh`;const revenueVisionUrl = `${origin}/api/insights/revenue-vision`;@@ -543,6 +545,7 @@ async function handleX402Discovery(req, res) {}const mcpAccepts = buildMcpAccepts(mcpUrl);+ const mcp3dAccepts = buildMcpAccepts(mcp3dUrl);const modelCheckAccepts = buildBazaarAccepts(modelCheckUrl);const mintToMeshAccepts = buildBazaarAccepts(mintToMeshUrl);const revenueVisionAccepts = buildBazaarAccepts(revenueVisionUrl);@@ -803,6 +806,22 @@ async function handleX402Discovery(req, res) {payment_config: `${origin}/.well-known/x402`,},},+ {+ path: '/api/mcp-3d',+ url: mcp3dUrl,+ method: 'POST',+ description: STUDIO_CHALLENGE.description,+ mimeType: 'application/json',+ serviceName: STUDIO_CHALLENGE.serviceName,+ tags: STUDIO_CHALLENGE.tags,+ iconUrl: STUDIO_CHALLENGE.iconUrl,+ accepts: mcp3dAccepts,+ extensions: extensionsForAccepts(mcp3dAccepts, STUDIO_CHALLENGE.bazaar),+ links: {+ docs: `${origin}/docs/mcp-3d-studio`,+ payment_config: `${origin}/.well-known/x402`,+ },+ },(() => {const url = `${origin}/api/x402/agent-reputation`;const accepts = acceptsForPrice('10000', url);diff --git a/avatar-sdk/package.json b/avatar-sdk/package.jsonindex 537500c14..9645e673d 100644--- a/avatar-sdk/package.json+++ b/avatar-sdk/package.json@@ -1,6 +1,6 @@{"name": "@three-ws/avatar",- "version": "0.1.0",+ "version": "0.2.0","description": "The official three.ws SDK — 3D avatar viewer, creator iframe, AR/VR runtime, and emotion + lipsync engine. Drop-in replacement for Ready Player Me.","keywords": ["3d",@@ -86,5 +86,11 @@},"engines": {"node": ">=18"+ },+ "bugs": {+ "url": "https://github.com/nirholas/three.ws/issues"+ },+ "publishConfig": {+ "access": "public"}}diff --git a/data/changelog.json b/data/changelog.jsonindex 23fe0cf04..e4643b725 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,34 @@{"$comment": "Curated changelog entries for three.ws — the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.","entries": [+ {+ "date": "2026-06-12",+ "title": "One tap rewrites your Forge prompt into a model-ready description",+ "summary": "Forge (/forge) has a new Enhance button next to the prompt box. Type a rough idea — \"a fox\", \"my coffee mug\" — and it rewrites it into the kind of single-subject, material-and-lighting description the text-to-3D pipeline reconstructs cleanly, then drops it straight into the box with one-tap Undo if you preferred your own words. It runs on the same free AI providers the rest of the site uses, so it costs nothing and needs no key, and if the rewrite ever can't run your prompt is left exactly as you wrote it. Shortcut: ⌘/Ctrl + E.",+ "tags": [+ "feature"+ ],+ "link": "/forge"+ },+ {+ "date": "2026-06-12",+ "title": "Forge helps you write a better prompt before you spend a generation",+ "summary": "The Forge (/forge) text box now coaches you in real time: it flags when a prompt asks for a whole scene (which reconstructs poorly) and nudges you to name a material or finish for a sharper mesh, with a live character counter. A new \"Surprise me\" button drops in a vivid, ready-to-forge prompt, and \"More ideas\" reshuffles the example chips — so you always have a strong starting point. The keyboard shortcut to generate (⌘/Ctrl + Enter) is now shown right on the button.",+ "tags": [+ "feature",+ "improvement"+ ],+ "link": "/forge"+ },+ {+ "date": "2026-06-12",+ "title": "Forge now shows how long your model has to go",+ "summary": "While the Forge (/forge) builds your 3D model, the progress now tracks against the typical time for the engine and quality you picked — so a 40-second wait reads as on-pace instead of an open-ended spinner. The bar fills honestly from real elapsed time, never jumps to done early, and if a job runs longer than usual it turns amber and tells you it's still working rather than leaving you guessing.",+ "tags": [+ "improvement"+ ],+ "link": "/forge"+ },{"date": "2026-06-12","title": "Text to 3D is live — and now front and center",diff --git a/mcp-server/package.json b/mcp-server/package.jsonindex 611275036..0d091d15e 100644--- a/mcp-server/package.json+++ b/mcp-server/package.json@@ -1,6 +1,6 @@{"name": "@3d-agent/mcp-server",- "version": "1.0.0",+ "version": "1.1.0","mcpName": "io.github.nirholas/3d-agent-mcp","description": "Paid MCP tools for the 3d-agent stack — pose generation, pump.fun snapshots, ERC-8004 agent reputation, Solana vanity grinder. Settled in USDC via x402.","type": "module",@@ -72,5 +72,8 @@"short-uuid": "6.0.3","zod": "^3.23.8","zod-to-json-schema": "3.25.2"+ },+ "bugs": {+ "url": "https://github.com/nirholas/three.ws/issues"}}diff --git a/packages/avatar-agent-mcp/package.json b/packages/avatar-agent-mcp/package.jsonindex 7b993339e..0d85fdf1c 100644--- a/packages/avatar-agent-mcp/package.json+++ b/packages/avatar-agent-mcp/package.json@@ -1,6 +1,6 @@{"name": "@three-ws/avatar-agent",- "version": "1.1.0",+ "version": "1.2.0","mcpName": "io.github.nirholas/3D-AI-Agent-Avatar","description": "3D AI Agent Avatar — MCP server that spawns a textured GLB avatar, inspects/validates/optimizes any 3D model, gives the agent a Solana wallet + a voice, and ships full pump.fun powers (atomic Jito-bundled launches + creator-fee collection). Powered by three.ws.","type": "module",diff --git a/packages/avatar-cli/package.json b/packages/avatar-cli/package.jsonindex e3d078d59..4c18a97d7 100644--- a/packages/avatar-cli/package.json+++ b/packages/avatar-cli/package.json@@ -1,6 +1,6 @@{"name": "@three-ws/avatar-cli",- "version": "0.1.0",+ "version": "0.2.0","description": "Terminal-native tooling for on-chain avatars: scaffold, validate, hash, and preview avatar manifests from your shell or CI.","keywords": ["three.ws",@@ -40,5 +40,11 @@},"engines": {"node": ">=18"+ },+ "bugs": {+ "url": "https://github.com/nirholas/three.ws/issues"+ },+ "publishConfig": {+ "access": "public"}}diff --git a/packages/avatar-schema/package.json b/packages/avatar-schema/package.jsonindex fe67849f1..2f954c4f9 100644--- a/packages/avatar-schema/package.json+++ b/packages/avatar-schema/package.json@@ -1,6 +1,6 @@{"name": "@three-ws/avatar-schema",- "version": "0.1.0",+ "version": "0.2.0","description": "JSON Schema and validator for three.ws on-chain avatar manifests — the canonical, hash-anchored format any cross-chain client can use to resolve an avatar.","keywords": ["three.ws",@@ -52,5 +52,11 @@},"engines": {"node": ">=18"+ },+ "bugs": {+ "url": "https://github.com/nirholas/three.ws/issues"+ },+ "publishConfig": {+ "access": "public"}}diff --git a/packages/ibm-watsonx-mcp/package.json b/packages/ibm-watsonx-mcp/package.jsonindex 1135179a2..8c90fa924 100644--- a/packages/ibm-watsonx-mcp/package.json+++ b/packages/ibm-watsonx-mcp/package.json@@ -1,6 +1,6 @@{"name": "@three-ws/ibm-watsonx-mcp",- "version": "0.1.1",+ "version": "0.2.0","description": "MCP server for IBM watsonx.ai by three.ws — chat, text generation, embeddings, tokenization, and model discovery with IBM Granite foundation models. Uses your own IBM Cloud credentials.","type": "module","author": "nirholas",diff --git a/packages/ibm-x402-mcp/package.json b/packages/ibm-x402-mcp/package.jsonindex 1d0d14bd0..32713ef1b 100644--- a/packages/ibm-x402-mcp/package.json+++ b/packages/ibm-x402-mcp/package.json@@ -1,6 +1,6 @@{"name": "@three-ws/ibm-x402-mcp",- "version": "1.0.0",+ "version": "1.1.0","description": "x402 pay-per-use MCP server for IBM Granite AI — chat, code, embeddings, analysis, and time-series forecasting. Pay USDC on Solana per call. No IBM Cloud account required.","type": "module","author": "nirholas",diff --git a/packages/pumpfun-mcp/package.json b/packages/pumpfun-mcp/package.jsonindex 857529b14..5d5cad39f 100644--- a/packages/pumpfun-mcp/package.json+++ b/packages/pumpfun-mcp/package.json@@ -1,6 +1,6 @@{"name": "@three-ws/pumpfun-mcp",- "version": "0.1.0",+ "version": "0.2.0","description": "Free, read-only pump.fun + Solana MCP server — token discovery, on-chain bonding-curve & holder analysis, creator fee-claim tracking, SNS resolution, KOL signals, and swap quotes. No API keys.","type": "module","author": "nirholas",diff --git a/packages/three-token-mcp/package.json b/packages/three-token-mcp/package.jsonindex d07eafbe3..da472d0ec 100644--- a/packages/three-token-mcp/package.json+++ b/packages/three-token-mcp/package.json@@ -1,6 +1,6 @@{"name": "@three-ws/three-token-mcp",- "version": "1.0.0",+ "version": "1.1.0","mcpName": "io.github.nirholas/three-token-mcp","description": "The first MCP server whose actions burn a token. Let any AI agent price, hold, and burn $THREE on-chain — every burn splits to the incinerator + treasury via the live three.ws token rail, with Jupiter USD pricing. Deflation as an agent primitive.","type": "module",diff --git a/packages/threews-avatar-mcp/package.json b/packages/threews-avatar-mcp/package.jsonindex 6a351b79c..cdb9c40ff 100644--- a/packages/threews-avatar-mcp/package.json+++ b/packages/threews-avatar-mcp/package.json@@ -1,6 +1,6 @@{"name": "@three-ws/avatar-mcp",- "version": "0.2.0",+ "version": "0.3.0","description": "MCP server for three.ws 3D avatars by three.ws — render a live, rotatable on-chain avatar inline (interactive MCP App), get a paste-anywhere embed iframe, or fetch avatar metadata. Free, no API key.","type": "module","author": "nirholas",diff --git a/packages/viewer-presets/package.json b/packages/viewer-presets/package.jsonindex dae52a49f..3ddac9ec0 100644--- a/packages/viewer-presets/package.json+++ b/packages/viewer-presets/package.json@@ -1,6 +1,6 @@{"name": "@three-ws/viewer-presets",- "version": "0.1.0",+ "version": "0.2.0","description": "Tuned visual presets for three.ws avatar viewers — light rigs, floor reflection, and bloom configs derived from Ready Player Me's visage (MIT).","keywords": ["three.ws",@@ -55,5 +55,11 @@},"engines": {"node": ">=18"+ },+ "bugs": {+ "url": "https://github.com/nirholas/three.ws/issues"+ },+ "publishConfig": {+ "access": "public"}}diff --git a/pages/create.html b/pages/create.htmlindex 4dc167d35..00635bf1b 100644--- a/pages/create.html+++ b/pages/create.html@@ -477,6 +477,88 @@border-color: rgba(160, 150, 255, 0.25);background: rgba(160, 150, 255, 0.07);}+ .chip-live-dot {+ display: inline-block;+ width: 5px;+ height: 5px;+ border-radius: 50%;+ margin-right: 5px;+ vertical-align: 1px;+ background: #58d68d;+ animation: chip-live-pulse 2.2s ease-in-out infinite;+ }+ @keyframes chip-live-pulse {+ 0%, 100% { box-shadow: 0 0 0 0 rgba(88, 214, 141, 0.5); }+ 50% { box-shadow: 0 0 0 3px rgba(88, 214, 141, 0); }+ }++ /* ── Featured live tile — the prompt → 3D path, iris-threaded ──────── */+ .tile--live {+ border-color: transparent;+ background:+ linear-gradient(var(--panel), var(--panel)) padding-box,+ linear-gradient(+ 120deg,+ rgba(255, 180, 84, 0.45),+ rgba(255, 106, 213, 0.45) 38%,+ rgba(139, 92, 246, 0.45) 64%,+ rgba(79, 195, 255, 0.45)+ )+ border-box;+ }+ .tile--live:hover {+ border-color: transparent;+ background:+ linear-gradient(var(--panel), var(--panel)) padding-box,+ linear-gradient(120deg, #ffb454, #ff6ad5 38%, #8b5cf6 64%, #4fc3ff)+ border-box;+ box-shadow:+ 0 14px 36px rgba(0, 0, 0, 0.45),+ 0 0 24px rgba(139, 92, 246, 0.14);+ }+ .tile--live .card-icon {+ color: #d8b4fe;+ }+ .card-example {+ display: flex;+ align-items: baseline;+ gap: 7px;+ margin: 10px 0 0;+ min-height: 18px;+ font-family: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, monospace;+ font-size: 11.5px;+ color: var(--muted);+ letter-spacing: 0.01em;+ }+ .card-example-mark {+ color: #a78bfa;+ }+ .card-example-text {+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+ }+ .card-example-caret {+ width: 6px;+ height: 12px;+ flex: 0 0 auto;+ align-self: center;+ background: rgba(232, 232, 232, 0.65);+ animation: card-caret-blink 1.1s steps(1) infinite;+ }+ @keyframes card-caret-blink {+ 50% { opacity: 0; }+ }+ @media (prefers-reduced-motion: reduce) {+ .card-example-caret,+ .chip-live-dot {+ animation: none;+ }+ .create-card,+ .create-card:hover {+ transform: none;+ }+ }/* ── CTAs ─────────────────────────────────────────────────────────── */.card-cta {@@ -1032,7 +1114,7 @@<div class="secondary-grid" role="group" aria-label="More ways to create"><div- class="create-card tile"+ class="create-card tile tile--live"id="card-prompt"role="button"tabindex="0"@@ -1060,8 +1142,13 @@Type what you want — a character, creature, or style. We render it,reconstruct it in 3D, and rig it so it can move.</p>+ <p class="card-example" aria-hidden="true">+ <span class="card-example-mark">›</span>+ <span class="card-example-text" id="card-prompt-example">a samurai in neon armor</span>+ <span class="card-example-caret"></span>+ </p><div class="card-meta" aria-hidden="true">- <span class="chip chip-ok">Now live</span>+ <span class="chip chip-ok"><span class="chip-live-dot" aria-hidden="true"></span>Now live</span><span class="chip">~1 min</span><span class="chip chip-auth">Sign-in</span><span class="chip">Rigged GLB</span>diff --git a/pages/forge.html b/pages/forge.htmlindex 144603f66..0d0723af7 100644--- a/pages/forge.html+++ b/pages/forge.html@@ -224,6 +224,161 @@background: var(--surface-2);box-shadow: none;}+ .gen-kbd {+ font-family: var(--font-mono);+ font-size: 0.72em;+ line-height: 1;+ padding: 0.2em 0.4em;+ border-radius: var(--radius-sm);+ background: rgba(0, 0, 0, 0.16);+ border: 1px solid rgba(0, 0, 0, 0.22);+ color: inherit;+ opacity: 0.85;+ }+ @media (max-width: 560px) {+ .gen-kbd {+ display: none;+ }+ }++ /* Prompt tools — surprise · coach · counter -------------------- */+ .prompt-tools {+ display: flex;+ align-items: center;+ gap: var(--space-sm);+ margin-top: var(--space-xs);+ flex-wrap: wrap;+ }+ .ptool {+ display: inline-flex;+ align-items: center;+ gap: 0.4rem;+ background: var(--surface-1);+ border: 1px solid var(--stroke);+ border-radius: 999px;+ color: var(--ink-dim);+ font-family: var(--font-mono);+ font-size: var(--text-xs);+ letter-spacing: 0.02em;+ padding: 0.32rem 0.72rem;+ cursor: pointer;+ transition:+ color 0.15s,+ border-color 0.15s,+ background 0.15s;+ }+ .ptool:hover {+ color: var(--ink);+ border-color: var(--stroke-strong);+ background: var(--surface-2);+ }+ .ptool:focus-visible {+ outline: 2px solid var(--accent);+ outline-offset: 2px;+ }+ .ptool svg {+ width: 14px;+ height: 14px;+ }+ .ptool.is-rolling svg {+ animation: dice-roll 0.5s cubic-bezier(0.3, 0.7, 0.3, 1);+ }+ @keyframes dice-roll {+ from {+ transform: rotate(0);+ }+ to {+ transform: rotate(360deg);+ }+ }+ @media (prefers-reduced-motion: reduce) {+ .ptool.is-rolling svg {+ animation: none;+ }+ }+ .prompt-coach {+ display: inline-flex;+ align-items: center;+ gap: 0.45rem;+ font-size: var(--text-xs);+ color: var(--ink-dim);+ line-height: 1.4;+ min-height: 1.2em;+ flex: 1 1 12rem;+ min-width: 0;+ }+ .prompt-coach::before {+ content: '';+ width: 6px;+ height: 6px;+ border-radius: 50%;+ background: var(--ink-dim);+ flex: none;+ transition:+ background 0.2s,+ box-shadow 0.2s;+ }+ .prompt-coach[data-grade='strong'] {+ color: var(--success);+ }+ .prompt-coach[data-grade='strong']::before {+ background: var(--success);+ box-shadow: 0 0 8px var(--success);+ }+ .prompt-coach[data-grade='warn'] {+ color: var(--warning, #e0a93e);+ }+ .prompt-coach[data-grade='warn']::before {+ background: var(--warning, #e0a93e);+ }+ .prompt-coach[data-grade='tip']::before {+ background: var(--accent);+ }+ .prompt-count {+ font-family: var(--font-mono);+ font-size: var(--text-xs);+ color: var(--ink-dim);+ flex: none;+ font-variant-numeric: tabular-nums;+ margin-left: auto;+ }+ .prompt-count[data-near='true'] {+ color: var(--warning, #e0a93e);+ }+ .chips-more {+ background: transparent;+ border: 1px dashed var(--stroke-strong);+ border-radius: 999px;+ color: var(--ink-dim);+ font-family: var(--font-mono);+ font-size: var(--text-xs);+ letter-spacing: 0.04em;+ padding: 0.4rem 0.85rem;+ cursor: pointer;+ transition:+ color 0.15s,+ border-color 0.15s,+ transform 0.4s ease;+ }+ .chips-more:hover {+ color: var(--ink);+ border-color: var(--accent);+ }+ .chips-more:focus-visible {+ outline: 2px solid var(--accent);+ outline-offset: 2px;+ }+ .chips-more.is-rolling {+ transform: rotate(180deg);+ }+ @media (prefers-reduced-motion: reduce) {+ .chips-more.is-rolling {+ transform: none;+ }+ }+ .chip.is-swapping {+ opacity: 0;+ }/* Quality tier + engine + BYOK --------------------------------- */.forge-quality {@@ -571,7 +726,8 @@transition:color 0.15s,border-color 0.15s,- background 0.15s;+ background 0.15s,+ opacity 0.18s ease;}.chip:hover {color: var(--ink);@@ -1377,6 +1533,98 @@color: var(--danger);}+ /* Fresh from the Forge — community showcase ------------------- */+ .showcase-head-right {+ display: inline-flex;+ align-items: center;+ gap: var(--space-xs);+ }+ .showcase-refresh {+ display: inline-grid;+ place-items: center;+ width: 26px;+ height: 26px;+ background: transparent;+ border: 1px solid var(--stroke);+ border-radius: 50%;+ color: var(--ink-dim);+ cursor: pointer;+ transition:+ color 0.15s,+ border-color 0.15s,+ transform 0.3s ease;+ }+ .showcase-refresh:hover {+ color: var(--ink);+ border-color: var(--stroke-strong);+ transform: rotate(90deg);+ }+ .showcase-refresh:focus-visible {+ outline: 2px solid var(--accent);+ outline-offset: 2px;+ }+ .showcase-sub {+ margin: calc(-1 * var(--space-sm)) 0 var(--space-md);+ color: var(--ink-dim);+ font-size: var(--text-sm);+ }+ .showcase-sub strong {+ color: var(--ink);+ }+ /* Card footer: time-ago on the left, Remix on the right. The card+ itself opens the model; Remix is its own button, so it never+ competes with the click target above it. */+ .showcase-foot {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: var(--space-xs);+ padding: 0 0.6rem 0.5rem;+ margin-top: auto;+ }+ .showcase-when {+ font-family: var(--font-mono);+ font-size: 0.65rem;+ color: var(--ink-dim);+ opacity: 0.8;+ }+ .showcase-remix {+ font-family: var(--font-mono);+ font-size: 0.65rem;+ letter-spacing: 0.04em;+ padding: 2px 9px;+ border-radius: 999px;+ border: 1px solid var(--stroke);+ background: transparent;+ color: var(--ink-dim);+ cursor: pointer;+ transition:+ color 0.15s,+ border-color 0.15s,+ background 0.15s;+ }+ .showcase-card:hover .showcase-remix,+ .showcase-remix:hover {+ color: var(--ink);+ border-color: var(--accent);+ }+ .showcase-remix:hover {+ background: var(--accent-soft);+ }+ .showcase-remix:focus-visible {+ outline: 2px solid var(--accent);+ outline-offset: 2px;+ }+ @media (prefers-reduced-motion: reduce) {+ .showcase-refresh,+ .showcase-remix {+ transition: none;+ }+ .showcase-refresh:hover {+ transform: none;+ }+ }+/* Empty + error + unconfigured */.notice {padding: var(--space-2xl) var(--space-lg);@@ -1417,12 +1665,127 @@.hint-foot a {color: var(--ink);}++ /* ── Refinements ─────────────────────────────────────────────────+ Hero glow, composer focus + drop affordances, tier sublabels.+ Pure presentation + discoverability over the existing real-async+ flow — no fabricated progress. */+ .forge-main {+ position: relative;+ }+ .forge-aurora {+ position: absolute;+ inset: -8% -18% auto -18%;+ height: 440px;+ z-index: -1;+ pointer-events: none;+ background:+ radial-gradient(+ 38% 60% at 32% 18%,+ color-mix(in srgb, var(--accent) 16%, transparent),+ transparent 70%+ ),+ radial-gradient(+ 44% 56% at 74% 8%,+ color-mix(in srgb, var(--accent) 11%, transparent),+ transparent 72%+ );+ filter: blur(40px);+ opacity: 0.75;+ animation: forge-aurora-drift 19s ease-in-out infinite alternate;+ }+ @keyframes forge-aurora-drift {+ from {+ transform: translate3d(-2%, 0, 0) scale(1);+ }+ to {+ transform: translate3d(3%, -3%, 0) scale(1.06);+ }+ }++ /* Composer hosts the drop overlay and lifts on focus so the active+ field reads as the focal point. */+ .composer {+ position: relative;+ transition:+ border-color 0.18s ease,+ box-shadow 0.18s ease;+ }+ .composer:focus-within {+ border-color: var(--stroke-strong);+ box-shadow:+ 0 24px 60px -30px rgba(0, 0, 0, 0.8),+ 0 0 0 1px var(--accent-soft);+ }++ /* Tier sublabels — compare the time/output trade-off without clicking. */+ #tier button {+ display: inline-flex;+ flex-direction: column;+ align-items: center;+ gap: 1px;+ line-height: 1.15;+ }+ #tier button .tier-sub {+ font-family: var(--font-mono);+ font-size: 0.56rem;+ letter-spacing: 0.02em;+ color: var(--ink-dim);+ font-weight: 400;+ }+ #tier button[aria-pressed='true'] .tier-sub {+ color: var(--ink);+ }++ /* Paste-or-drag-a-photo-anywhere overlay over the composer. */+ .composer-drop {+ position: absolute;+ inset: 0;+ z-index: 5;+ display: none;+ place-items: center;+ border-radius: var(--radius-lg);+ border: 1.5px dashed var(--accent);+ background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface-glass));+ backdrop-filter: blur(3px);+ -webkit-backdrop-filter: blur(3px);+ color: var(--ink);+ font-family: var(--font-display);+ font-weight: 600;+ text-align: center;+ pointer-events: none;+ }+ .composer.is-drop-active .composer-drop {+ display: grid;+ }+ .composer-drop .drop-inner {+ display: flex;+ flex-direction: column;+ align-items: center;+ gap: 0.3rem;+ }+ .composer-drop .drop-glyph {+ font-size: 1.9rem;+ line-height: 1;+ }+ .composer-drop small {+ font-family: var(--font-body);+ font-weight: 400;+ color: var(--ink-dim);+ }++ @media (prefers-reduced-motion: reduce) {+ .forge-aurora {+ animation: none;+ }+ }</style></head><body><div id="nav-container"></div><main class="forge-main">+ <div class="forge-aurora" aria-hidden="true"></div><header class="forge-head"><span class="forge-eyebrow">Text · Image · Multi-view → 3D · live</span><h1>Forge a 3D model from words or photos</h1>@@ -1600,6 +1963,16 @@<kbd class="gen-kbd" aria-hidden="true">⌘↵</kbd></button></div>++ <!-- Drag a photo onto the page, or paste one from the clipboard,+ to jump straight into multi-view reconstruction. -->+ <div class="composer-drop" id="composer-drop" aria-hidden="true">+ <div class="drop-inner">+ <span class="drop-glyph" aria-hidden="true">⤓</span>+ Drop a photo to reconstruct+ <small>PNG, JPG or WebP · up to 4 views of one object</small>+ </div>+ </div></form><div class="chips" id="examples" aria-label="Example prompts">@@ -1855,6 +2228,49 @@<div class="creations-grid" id="creations-grid"></div></section>+ <!-- Fresh from the Forge — newest community models (src/forge-showcase.js).+ Hidden until the public feed returns real rows, so deployments without+ a durable store never show a hollow strip. -->+ <section+ class="creations showcase is-hidden"+ id="showcase"+ aria-label="Fresh from the Forge — recent community models"+ >+ <div class="creations-head">+ <h2>Fresh from the Forge</h2>+ <div class="showcase-head-right">+ <span class="count" id="showcase-count"></span>+ <button+ type="button"+ class="showcase-refresh"+ id="showcase-refresh"+ title="Refresh the community feed"+ aria-label="Refresh the community feed"+ >+ <svg+ width="13"+ height="13"+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ stroke-width="2"+ stroke-linecap="round"+ stroke-linejoin="round"+ aria-hidden="true"+ >+ <path d="M21 12a9 9 0 1 1-2.64-6.36" />+ <path d="M21 3v6h-6" />+ </svg>+ </button>+ </div>+ </div>+ <p class="showcase-sub">+ What other people just forged. Open one in the viewer, or+ <strong>Remix</strong> its prompt and make it yours.+ </p>+ <div class="creations-grid" id="showcase-grid"></div>+ </section>+<p class="hint-foot">Powered by flux-schnell + Microsoft TRELLIS on Replicate, with multi-viewconditioning when you supply more than one photo. Best results: one clearly@@ -1865,8 +2281,12 @@<script src="/nav.js" defer></script><script type="module" src="/src/forge.js"></script>+ <script type="module" src="/src/forge-prompt-studio.js"></script>+ <script type="module" src="/src/forge-enhance.js"></script><script type="module" src="/src/forge-stylize.js"></script><script type="module" src="/src/forge-optimize.js"></script>+ <script type="module" src="/src/forge-showcase.js"></script>+ <script type="module" src="/src/forge-dropzone.js"></script><div id="footer-container"></div><script src="/footer.js"></script></body>diff --git a/pages/home.html b/pages/home.htmlindex 970d00c10..b7e296c57 100644--- a/pages/home.html+++ b/pages/home.html@@ -2407,7 +2407,7 @@</ul><div class="hero-cta-row"><a class="btn btn--primary" href="/create">Build your agent <span class="arrow">→</span></a>- <a class="btn" href="/forge">Text → 3D · live</a>+ <a class="btn btn--forge" href="/forge"><span class="btn-forge-dot" aria-hidden="true"></span>Text → 3D</a><a class="btn" href="#embed">See the embed</a></div></div>@@ -3242,12 +3242,20 @@#home-forge .hf-viewer { inset: 0 0 120px; }#home-forge .hf-result-bar { bottom: 112px; left: 18px; right: 18px; transform: none; max-width: none; justify-content: space-between; }#home-forge .hf-ground { bottom: 150px; }+ /* History becomes a horizontal scroller pinned under the HUD. */+ #home-forge .hf-history { left: 16px; right: 16px; top: 44px; flex-direction: row; align-items: center; gap: 8px; max-height: none; }+ #home-forge .hf-history-label { display: none; }+ #home-forge .hf-history-track { flex-direction: row; overflow-x: auto; overflow-y: hidden; }+ #home-forge .hf-thumb { width: 40px; height: 40px; }+ #home-forge .hf-toast { bottom: 180px; }}@media (prefers-reduced-motion: reduce) {#home-forge .hf-ring, #home-forge .hf-ring-glow { animation: none; }#home-forge .hf-viewer.is-in { animation: none; }#home-forge .hf-scan.is-scan, #home-forge .hf-scan.is-scan::before { animation: none; opacity: 0; }#home-forge .hf-hud .dot { animation: none; }+ #home-forge .hf-thumb { animation: none; }+ #home-forge .hf-toast { transition: opacity 0.2s ease; }}</style><section class="block" id="home-forge">@@ -4073,6 +4081,7 @@<p class="vclose-sub">Free to start. Two lines of HTML. Voice, memory, and payments included.</p><div class="cta-row" style="justify-content:center;"><a class="btn btn--primary" href="/create">Build your agent <span class="arrow">→</span></a>+ <a class="btn btn--forge" href="/forge"><span class="btn-forge-dot" aria-hidden="true"></span>Text → 3D</a><a class="btn" href="/docs">Read the docs</a></div><div class="vclose-chips" id="vclose-chips" role="group" aria-label="Trigger an animation">diff --git a/public/buttons.css b/public/buttons.cssindex 6b5e2630e..8a9af7c7a 100644--- a/public/buttons.css+++ b/public/buttons.css@@ -173,16 +173,17 @@border, with a live pulse dot. Dark-surface pages only (the gradientborder is painted over a near-black padding-box). */.btn--forge {+ --btn-forge-surface: var(--bg-1, #141414);border-color: transparent;color: var(--text, #e8e8e8);background:- linear-gradient(var(--btn-forge-surface, #0c0c0f), var(--btn-forge-surface, #0c0c0f)) padding-box,+ linear-gradient(var(--btn-forge-surface), var(--btn-forge-surface)) padding-box,linear-gradient(120deg, rgba(255, 180, 84, 0.5), rgba(255, 106, 213, 0.5) 38%, rgba(139, 92, 246, 0.5) 64%, rgba(79, 195, 255, 0.5)) border-box;}.btn--forge:hover:not(:disabled):not([aria-disabled='true']) {border-color: transparent;background:- linear-gradient(var(--btn-forge-surface, #101014), var(--btn-forge-surface, #101014)) padding-box,+ linear-gradient(var(--btn-forge-surface), var(--btn-forge-surface)) padding-box,linear-gradient(120deg, #ffb454, #ff6ad5 38%, #8b5cf6 64%, #4fc3ff) border-box;box-shadow: 0 0 18px rgba(139, 92, 246, 0.18);}diff --git a/public/changelog.json b/public/changelog.jsonindex 26d0545ac..ddd3ec3f7 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-12T23:17:22.932Z",+ "generated_at": "2026-06-12T23:29:29.408Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -118,6 +118,17 @@"fix"]},+ {+ "date": "2026-06-12",+ "type": "update",+ "title": "Forge helps you write a better prompt before you spend a generation",+ "summary": "The Forge (/forge) text box now coaches you in real time: it flags when a prompt asks for a whole scene (which reconstructs poorly) and nudges you to name a material or finish for a sharper mesh, with a live character counter. A new \"Surprise me\" button drops in a vivid, ready-to-forge prompt, and \"More ideas\" reshuffles the example chips — so you always have a strong starting point. The keyboard shortcut to generate (⌘/Ctrl + Enter) is now shown right on the button.",+ "link": "/forge",+ "tags": [+ "feature",+ "improvement"+ ]+ },{"date": "2026-06-12","type": "update",@@ -139,6 +150,16 @@"fix"]},+ {+ "date": "2026-06-12",+ "type": "update",+ "title": "Forge now shows how long your model has to go",+ "summary": "While the Forge (/forge) builds your 3D model, the progress now tracks against the typical time for the engine and quality you picked — so a 40-second wait reads as on-pace instead of an open-ended spinner. The bar fills honestly from real elapsed time, never jumps to done early, and if a job runs longer than usual it turns amber and tells you it's still working rather than leaving you guessing.",+ "link": "/forge",+ "tags": [+ "improvement"+ ]+ },{"date": "2026-06-12","type": "update",@@ -159,6 +180,16 @@"feature"]},+ {+ "date": "2026-06-12",+ "type": "update",+ "title": "One tap rewrites your Forge prompt into a model-ready description",+ "summary": "Forge (/forge) has a new Enhance button next to the prompt box. Type a rough idea — \"a fox\", \"my coffee mug\" — and it rewrites it into the kind of single-subject, material-and-lighting description the text-to-3D pipeline reconstructs cleanly, then drops it straight into the box with one-tap Undo if you preferred your own words. It runs on the same free AI providers the rest of the site uses, so it costs nothing and needs no key, and if the rewrite ever can't run your prompt is left exactly as you wrote it. Shortcut: ⌘/Ctrl + E.",+ "link": "/forge",+ "tags": [+ "feature"+ ]+ },{"date": "2026-06-12","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex e3589eb85..833bedecd 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -94,6 +94,14 @@<category>improvement</category><description>The engine buttons on Forge now reflect what's actually running, probed live against each provider — not just whether it's set up. An engine whose upstream is down or unreachable is disabled with the reason in its tooltip, a throttled one shows an amber busy dot, and bring-your-own-key engines (Meshy, Tripo) say so before you pick them. Behind it is a new public health check at /api/forge?health, and the self-hosted Hunyuan3D lane was rewired to its own worker so it no longer fails every prompt by routing to the avatar pipeline.</description></item>+ <item>+ <title>Forge helps you write a better prompt before you spend a generation</title>+ <link>https://three.ws/forge</link>+ <guid isPermaLink="false">2026-06-12:Forge helps you write a better prompt before you spend a generation</guid>+ <pubDate>Fri, 12 Jun 2026 12:00:00 GMT</pubDate>+ <category>feature</category>+ <description>The Forge (/forge) text box now coaches you in real time: it flags when a prompt asks for a whole scene (which reconstructs poorly) and nudges you to name a material or finish for a sharper mesh, with a live character counter. A new "Surprise me" button drops in a vivid, ready-to-forge prompt, and "More ideas" reshuffles the example chips — so you always have a strong starting point. The keyboard shortcut to generate (⌘/Ctrl + Enter) is now shown right on the button.</description>+ </item><item><title>Forge is now one click away from every feed</title><link>https://three.ws/forge</link>@@ -110,6 +118,14 @@<category>improvement</category><description>The "what's next" card after a Forge or Parts Studio result used to send you to the studio empty-handed — the model stayed behind. The primary action is now "Open in Scene Studio" and it brings the exact model you just made with it: Scene Studio opens with the GLB already imported, named after your prompt, ready to compose, edit, and export. Your work carries over instead of starting from a blank scene.</description></item>+ <item>+ <title>Forge now shows how long your model has to go</title>+ <link>https://three.ws/forge</link>+ <guid isPermaLink="false">2026-06-12:Forge now shows how long your model has to go</guid>+ <pubDate>Fri, 12 Jun 2026 12:00:00 GMT</pubDate>+ <category>improvement</category>+ <description>While the Forge (/forge) builds your 3D model, the progress now tracks against the typical time for the engine and quality you picked — so a 40-second wait reads as on-pace instead of an open-ended spinner. The bar fills honestly from real elapsed time, never jumps to done early, and if a job runs longer than usual it turns amber and tells you it's still working rather than leaving you guessing.</description>+ </item><item><title>Forge's free Draft engine no longer loses finished models</title><link>https://three.ws/forge</link>@@ -126,6 +142,14 @@<category>feature</category><description>There is now a public feed of every coin launched by a three.ws agent at /launches — live market caps, graduation badges, buyback rates, and a card linking straight to the agent behind each launch. Agent profile pages also gained a launch history: every coin an agent has ever launched is listed on its page with a live market cap and a link into the public feed. Find it in the nav under Discover → Agent Launches.</description></item>+ <item>+ <title>One tap rewrites your Forge prompt into a model-ready description</title>+ <link>https://three.ws/forge</link>+ <guid isPermaLink="false">2026-06-12:One tap rewrites your Forge prompt into a model-ready description</guid>+ <pubDate>Fri, 12 Jun 2026 12:00:00 GMT</pubDate>+ <category>feature</category>+ <description>Forge (/forge) has a new Enhance button next to the prompt box. Type a rough idea — "a fox", "my coffee mug" — and it rewrites it into the kind of single-subject, material-and-lighting description the text-to-3D pipeline reconstructs cleanly, then drops it straight into the box with one-tap Undo if you preferred your own words. It runs on the same free AI providers the rest of the site uses, so it costs nothing and needs no key, and if the rewrite ever can't run your prompt is left exactly as you wrote it. Shortcut: ⌘/Ctrl + E.</description>+ </item><item><title>Pay a real x402 oracle inside the $THREE town</title><link>https://three.ws/play</link>diff --git a/public/features.json b/public/features.jsonindex 99b991c36..ac7568232 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-12T23:17:22.919Z",+ "generated_at": "2026-06-12T23:29:29.351Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/public/nav.css b/public/nav.cssindex 22e7ff2e7..ffecf14fd 100644--- a/public/nav.css+++ b/public/nav.css@@ -418,6 +418,19 @@.nav-drawer a.nav-hot {display: flex; align-items: center; gap: 8px; color: var(--nv-text);}+/* Light bar: white-alpha pill chrome washes out — remap to ink tints. */+:root[data-theme='light'] .nav-main > a.nav-hot {+ border-color: rgba(15, 18, 28, 0.18);+ background: rgba(15, 18, 28, 0.04);+}+:root[data-theme='light'] .nav-main > a.nav-hot:hover {+ border-color: rgba(15, 18, 28, 0.34);+ background: rgba(15, 18, 28, 0.07);+}+:root[data-theme='light'] .nav-pill-live {+ background: rgba(46, 160, 90, 0.12); color: #1e8e4e;+ box-shadow: inset 0 0 0 1px rgba(46, 160, 90, 0.3);+}.nav-pop-note {padding: 6px 12px 8px; font-size: var(--text-2xs); color: var(--nv-text-4);line-height: 1.45; grid-column: 1 / -1;diff --git a/scripts/check-forge-polish.mjs b/scripts/check-forge-polish.mjsnew file mode 100644index 000000000..14e998e38--- /dev/null+++ b/scripts/check-forge-polish.mjs@@ -0,0 +1,66 @@+import { chromium } from 'playwright';+const base = 'http://localhost:3123';+const browser = await chromium.launch();++// Desktop 1440+const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });+await page.goto(base + '/', { waitUntil: 'domcontentloaded' });+await page.waitForSelector('.nav-main a.nav-hot', { timeout: 10000 });+await page.waitForTimeout(1200);+await page.screenshot({ path: '/tmp/shot-home-hero-1440.png', clip: { x: 0, y: 0, width: 1440, height: 760 } });++// Build dropdown open+await page.hover('.nav-grp:first-child .nav-trigger');+await page.click('.nav-grp:first-child .nav-trigger');+await page.waitForTimeout(400);+await page.screenshot({ path: '/tmp/shot-nav-build-menu.png', clip: { x: 0, y: 0, width: 900, height: 620 } });++// nav-hot hover state+await page.keyboard.press('Escape');+await page.hover('.nav-main a.nav-hot');+await page.waitForTimeout(300);+await page.screenshot({ path: '/tmp/shot-nav-hot-hover.png', clip: { x: 0, y: 0, width: 1440, height: 64 } });++// /create featured card+await page.goto(base + '/create', { waitUntil: 'domcontentloaded' });+await page.waitForSelector('#card-prompt', { timeout: 10000 });+await page.waitForTimeout(1000);+const ex1 = await page.locator('#card-prompt-example').innerText();+await page.locator('#card-prompt').scrollIntoViewIfNeeded();+await page.screenshot({ path: '/tmp/shot-create-card.png', clip: { x: 0, y: 0, width: 1440, height: 900 } });+await page.waitForTimeout(7000);+const ex2 = await page.locator('#card-prompt-example').innerText();+console.log('typewriter cycling:', JSON.stringify(ex1), '->', JSON.stringify(ex2), ex1 !== ex2 ? 'OK' : 'NOT CYCLING (may be mid-hold)');++// hover the featured card+await page.hover('#card-prompt');+await page.waitForTimeout(300);+const card = await page.locator('#card-prompt').boundingBox();+await page.screenshot({ path: '/tmp/shot-create-card-hover.png', clip: { x: Math.max(0, card.x - 20), y: Math.max(0, card.y - 20), width: 560, height: 380 } });++// Light theme nav+await page.evaluate(() => { localStorage.setItem('twx_theme', 'light'); });+await page.goto(base + '/', { waitUntil: 'domcontentloaded' });+await page.waitForSelector('.nav-main a.nav-hot', { timeout: 10000 });+await page.waitForTimeout(800);+await page.screenshot({ path: '/tmp/shot-nav-light.png', clip: { x: 0, y: 0, width: 1440, height: 64 } });+await page.evaluate(() => { localStorage.setItem('twx_theme', 'auto'); });++// Mobile 375 drawer+const m = await browser.newPage({ viewport: { width: 375, height: 720 } });+await m.goto(base + '/', { waitUntil: 'domcontentloaded' });+await m.waitForSelector('.nav-toggle', { timeout: 10000 });+await m.click('.nav-toggle');+await m.waitForTimeout(500);+await m.screenshot({ path: '/tmp/shot-drawer-375.png' });+// drawer hot link present?+const drawerHot = await m.locator('.nav-drawer a.nav-hot').count();+console.log('drawer hot link:', drawerHot);++// Mobile hero+await m.click('.nav-toggle');+await m.waitForTimeout(300);+await m.screenshot({ path: '/tmp/shot-home-375.png' });++await browser.close();+console.log('done');diff --git a/scripts/normalize-pkg-meta.mjs b/scripts/normalize-pkg-meta.mjsnew file mode 100644index 000000000..3f927c783--- /dev/null+++ b/scripts/normalize-pkg-meta.mjs@@ -0,0 +1,65 @@+#!/usr/bin/env node+// One-off: normalize publishable package.json metadata to the three.ws house style.+// Adds only MISSING top-level fields (never overwrites license/description/exports),+// preserves each file's original indentation and key order, and bumps versions.+import { readFileSync, writeFileSync, existsSync } from 'node:fs';+import { resolve } from 'node:path';++const ROOT = resolve(process.argv[2] ?? '.');++// dir -> { version, keywords?, engineNode }+const TARGETS = {+ 'solana-agent-sdk': { version: '0.2.0', engineNode: '>=18', keywords: ['three.ws','solana','agent','wallet','keypair','x402','spl-token','swap','jupiter','web3','crypto-payments','agentic'] },+ 'avatar-sdk': { version: '0.2.0', engineNode: '>=18' },+ 'sdk': { version: '0.2.0', engineNode: '>=18' },+ 'agent-ui-sdk': { version: '0.2.0', engineNode: '>=18' },+ 'mcp-server': { version: '1.1.0', engineNode: '>=20' },+ 'agent-payments-sdk': { version: '3.2.0', engineNode: '>=18', keywords: ['three.ws','solana','payments','agent-payments','x402','token-2022','usdc','a2a','cross-chain','pump.fun','agentic','web3'] },+ 'packages/viewer-presets': { version: '0.2.0', engineNode: '>=18' },+ 'packages/avatar-cli': { version: '0.2.0', engineNode: '>=18' },+ 'packages/avatar-schema': { version: '0.2.0', engineNode: '>=18' },+ 'agent-protocol-sdk': { version: '0.2.0', engineNode: '>=18', license: 'MIT', keywords: ['3d-agent','three.ws','agent-protocol','agent-to-agent','a2a','solana','anchor','on-chain','erc-8004','agentic','web3'] },+ 'packages/pumpfun-mcp': { version: '0.2.0', engineNode: '>=20' },+ 'packages/ibm-watsonx-mcp': { version: '0.2.0', engineNode: '>=20' },+ 'packages/avatar-agent-mcp': { version: '1.2.0', engineNode: '>=20' },+ 'packages/threews-avatar-mcp': { version: '0.3.0', engineNode: '>=20' },+ 'packages/ibm-x402-mcp': { version: '1.1.0', engineNode: '>=20' },+ 'packages/three-token-mcp': { version: '1.1.0', engineNode: '>=20' },+};++const AUTHOR = 'three.ws <[email protected]> (https://three.ws)';+const HOMEPAGE = 'https://three.ws';+const REPO_URL = 'https://github.com/nirholas/three.ws.git';+const BUGS_URL = 'https://github.com/nirholas/three.ws/issues';++function detectIndent(raw) {+ const m = raw.match(/\n(\t| +)"/);+ if (!m) return 2;+ return m[1] === '\t' ? '\t' : m[1].length;+}++let changed = 0;+for (const [dir, t] of Object.entries(TARGETS)) {+ const file = resolve(ROOT, dir, 'package.json');+ if (!existsSync(file)) { console.warn('skip (missing):', dir); continue; }+ const raw = readFileSync(file, 'utf8');+ const indent = detectIndent(raw);+ const pkg = JSON.parse(raw);++ pkg.version = t.version;+ if (!pkg.description) console.warn(' WARN no description:', dir);+ if (t.keywords && (!Array.isArray(pkg.keywords) || pkg.keywords.length === 0)) pkg.keywords = t.keywords;+ if (t.license && !pkg.license) pkg.license = t.license;+ if (!pkg.author) pkg.author = AUTHOR;+ if (!pkg.homepage) pkg.homepage = `${HOMEPAGE}/`;+ if (!pkg.repository) pkg.repository = { type: 'git', url: REPO_URL, directory: dir };+ if (!pkg.bugs) pkg.bugs = { url: BUGS_URL };+ if (!pkg.engines) pkg.engines = { node: t.engineNode };+ if (!pkg.publishConfig) pkg.publishConfig = { access: 'public' };+ if (pkg.publishConfig && pkg.publishConfig.access !== 'public') pkg.publishConfig.access = 'public';++ writeFileSync(file, JSON.stringify(pkg, null, indent) + '\n');+ console.log('normalized', dir, '->', pkg.version);+ changed++;+}+console.log(`\n${changed} package.json files normalized.`);diff --git a/scripts/verify-home-forge.mjs b/scripts/verify-home-forge.mjsindex 7dd13c8bf..aa5abb752 100644--- a/scripts/verify-home-forge.mjs+++ b/scripts/verify-home-forge.mjs@@ -1,56 +1,99 @@-// One-off check: drive the homepage mini Forge end-to-end against a real-// deployment (BASE_URL, default https://three.ws) and report what the user-// would actually see. Usage: node scripts/verify-home-forge.mjs+// Drive the homepage mini Forge end-to-end and report what a user sees.+//+// BASE_URL=https://three.ws node scripts/verify-home-forge.mjs # against prod+// node scripts/verify-home-forge.mjs # local dev,+// proxying /api/forge to PROXY_API (default prod) so generation is real.import { chromium } from 'playwright';-const BASE_URL = process.env.BASE_URL || 'https://three.ws';+const BASE_URL = process.env.BASE_URL || 'http://localhost:5191';+const PROXY_API = process.env.PROXY_API || 'https://three.ws';+const PROXY = !/^https:\/\/three\.ws/.test(BASE_URL); // proxy only when localconst browser = await chromium.launch();-const page = await browser.newPage();-const consoleErrors = [];+const ctx = await browser.newContext({ viewport: { width: 1440, height: 1000 } });+const page = await ctx.newPage();++const problems = [];page.on('console', (m) => {- if (m.type() === 'error' || m.type() === 'warning') consoleErrors.push(`[${m.type()}] ${m.text()}`);-});-page.on('pageerror', (e) => consoleErrors.push(`[pageerror] ${e.message}`));-const forgeRequests = [];-page.on('response', async (res) => {- if (res.url().includes('/api/forge')) {- let body = '';- try { body = (await res.text()).slice(0, 400); } catch {}- forgeRequests.push(`${res.request().method()} ${res.url()} → ${res.status()} ${body}`);- }+ if (m.type() === 'error' || m.type() === 'warning') problems.push(`[${m.type()}] ${m.text()}`);});+page.on('pageerror', (e) => problems.push(`[pageerror] ${e.message}`));++// When testing local UI, forward the API to a real deployment so the GLB is real.+if (PROXY) {+ await page.route('**/api/forge*', async (route) => {+ const req = route.request();+ const resp = await ctx.request.fetch(PROXY_API + new URL(req.url()).pathname + new URL(req.url()).search, {+ method: req.method(),+ headers: req.headers(),+ data: req.postData() || undefined,+ });+ route.fulfill({ status: resp.status(), headers: resp.headers(), body: await resp.body() });+ });+}await page.goto(BASE_URL + '/', { waitUntil: 'domcontentloaded', timeout: 60000 });const section = page.locator('#home-forge');-console.log('section present:', await section.count());-await section.scrollIntoViewIfNeeded();-// Give the IntersectionObserver-gated module a moment to import and boot.-await page.waitForTimeout(4000);--const promptBox = page.locator('#hf-prompt-input');-console.log('prompt box visible:', await promptBox.isVisible().catch(() => false));--await promptBox.fill('a glazed ceramic teapot, studio lighting');-await page.locator('[data-hf-generate]').click();-console.log('clicked Forge, waiting for result/error…');--const outcome = await Promise.race([- page.locator('[data-hf-result]:not([hidden]) model-viewer').waitFor({ timeout: 120000 }).then(() => 'RESULT'),- page.locator('[data-hf-error]:not([hidden])').waitFor({ timeout: 120000 }).then(() => 'ERROR'),-]).catch(() => 'TIMEOUT');-console.log('outcome:', outcome);-if (outcome === 'ERROR') {- console.log('error message:', await page.locator('[data-hf-error-message]').textContent());+await page.waitForTimeout(3500);+console.log('section present:', await section.count(), '| prompt visible:', await page.locator('#hf-prompt-input').isVisible());++async function forge(prompt) {+ await page.locator('#hf-prompt-input').fill(prompt);+ await page.locator('[data-hf-generate]').click();+ const outcome = await Promise.race([+ page.locator('[data-hf-result]:not([hidden]) model-viewer').waitFor({ timeout: 150000 }).then(() => 'RESULT'),+ page.locator('[data-hf-error]:not([hidden])').waitFor({ timeout: 150000 }).then(() => 'ERROR'),+ ]).catch(() => 'TIMEOUT');+ if (outcome !== 'RESULT') {+ console.log(` forge("${prompt}") → ${outcome}:`, await page.locator('[data-hf-error-message]').textContent().catch(() => ''));+ return false;+ }+ await page.waitForFunction(() => { const mv = document.querySelector('#home-forge model-viewer'); return mv && mv.loaded; }, { timeout: 60000 }).catch(() => {});+ await page.waitForTimeout(2000); // let the thumbnail capture land+ console.log(` forge("${prompt}") → RESULT`);+ return true;}-if (outcome === 'RESULT') {- console.log('glb src:', await page.locator('[data-hf-result] model-viewer').getAttribute('src'));++console.log('\nForging two models…');+await forge('a glazed ceramic teapot, studio lighting');+await forge('a low-poly red fox, sitting');++// History rail should now hold both, with real thumbnails.+const thumbs = page.locator('#home-forge .hf-thumb');+const thumbCount = await thumbs.count();+const withImage = await page.locator('#home-forge .hf-thumb[style*="background-image"]').count();+console.log(`\nhistory thumbnails: ${thumbCount} (with captured image: ${withImage})`);++// Toolbar wiring.+console.log('Scene Studio href:', await page.locator('[data-hf-scene]').getAttribute('href'));+console.log('Download href:', (await page.locator('[data-hf-download]').getAttribute('href') || '').slice(0, 60) + '…');+console.log('AR attr on viewer:', await page.locator('#home-forge model-viewer').getAttribute('ar') !== null);++// Auto-rotate toggle.+const beforePressed = await page.locator('[data-hf-spin]').getAttribute('aria-pressed');+await page.locator('[data-hf-spin]').click();+const afterPressed = await page.locator('[data-hf-spin]').getAttribute('aria-pressed');+console.log(`auto-rotate toggle: ${beforePressed} → ${afterPressed}`);++// Copy share link → toast.+await page.locator('[data-hf-share]').click();+await page.waitForTimeout(400);+console.log('share toast:', (await page.locator('[data-hf-toast]').textContent().catch(() => '')) || '(none)');++// Reload from history: click the older (second) thumbnail.+if (thumbCount >= 2) {+ const targetGlb = await thumbs.nth(1).getAttribute('data-glb');+ await thumbs.nth(1).click();+ await page.waitForTimeout(1500);+ const liveSrc = await page.locator('#home-forge model-viewer').getAttribute('src');+ console.log('reload-from-history matched:', liveSrc === targetGlb);+ console.log('active thumb marked:', await thumbs.nth(1).getAttribute('aria-current'));}-console.log('\n/api/forge traffic:');-forgeRequests.forEach((r) => console.log(' ', r));-console.log('\nconsole errors/warnings:');-consoleErrors.slice(0, 20).forEach((e) => console.log(' ', e));-await page.screenshot({ path: 'reports/home-forge-verify.png', clip: (await section.boundingBox()) || undefined });+console.log('\nconsole errors/warnings:', problems.length);+problems.slice(0, 15).forEach((p) => console.log(' ', p));++await section.screenshot({ path: 'reports/home-forge-improved.png' });await browser.close();+console.log('\nscreenshot → reports/home-forge-improved.png');diff --git a/sdk/package.json b/sdk/package.jsonindex eda25652e..2539cc561 100644--- a/sdk/package.json+++ b/sdk/package.json@@ -1,6 +1,6 @@{"name": "@three-ws/sdk",- "version": "0.1.0",+ "version": "0.2.0","description": "Ship a cross-chain 3D AI agent with EVM + Solana identity, a chat panel, and discoverable .well-known endpoints.","type": "module","main": "./src/index.js",@@ -50,8 +50,19 @@"access": "public"},"keywords": [- "erc-8004", "agent", "blockchain", "a2a", "mcp",- "ethereum", "solana", "web3", "identity", "3d", "ai", "nft", "metaplex"+ "erc-8004",+ "agent",+ "blockchain",+ "a2a",+ "mcp",+ "ethereum",+ "solana",+ "web3",+ "identity",+ "3d",+ "ai",+ "nft",+ "metaplex"],"license": "MIT","peerDependencies": {@@ -59,7 +70,24 @@"@solana/web3.js": "^1.0.0"},"peerDependenciesMeta": {- "ethers": { "optional": true },- "@solana/web3.js": { "optional": true }+ "ethers": {+ "optional": true+ },+ "@solana/web3.js": {+ "optional": true+ }+ },+ "author": "three.ws <[email protected]> (https://three.ws)",+ "homepage": "https://three.ws/",+ "repository": {+ "type": "git",+ "url": "https://github.com/nirholas/three.ws.git",+ "directory": "sdk"+ },+ "bugs": {+ "url": "https://github.com/nirholas/three.ws/issues"+ },+ "engines": {+ "node": ">=18"}}diff --git a/solana-agent-sdk/package.json b/solana-agent-sdk/package.jsonindex 552777bb3..52dfa97f1 100644--- a/solana-agent-sdk/package.json+++ b/solana-agent-sdk/package.json@@ -1,6 +1,6 @@{"name": "@three-ws/solana-agent",- "version": "0.1.0",+ "version": "0.2.0","description": "Solana agent SDK — keypair + browser wallet, transfers, swaps, x402 exact scheme","type": "module","main": "./dist/index.cjs",@@ -69,5 +69,32 @@"publishConfig": {"access": "public"},- "license": "MIT"+ "license": "MIT",+ "keywords": [+ "three.ws",+ "solana",+ "agent",+ "wallet",+ "keypair",+ "x402",+ "spl-token",+ "swap",+ "jupiter",+ "web3",+ "crypto-payments",+ "agentic"+ ],+ "author": "three.ws <[email protected]> (https://three.ws)",+ "homepage": "https://three.ws/",+ "repository": {+ "type": "git",+ "url": "https://github.com/nirholas/three.ws.git",+ "directory": "solana-agent-sdk"+ },+ "bugs": {+ "url": "https://github.com/nirholas/three.ws/issues"+ },+ "engines": {+ "node": ">=18"+ }}diff --git a/src/create.js b/src/create.jsindex b3402d155..a00f46178 100644--- a/src/create.js+++ b/src/create.js@@ -181,6 +181,8 @@ async function boot() {document.getElementById('glb-input').click();});+ startPromptExampleLoop();+document.getElementById('glb-input').addEventListener('change', async (e) => {const file = e.target.files?.[0];if (!file) return;@@ -255,6 +257,74 @@ async function loadYourAvatars() {section.hidden = false;}+// The featured prompt card demos its own value proposition: a slow typewriter+// cycles real example prompts in the card's example line. The element is+// aria-hidden (pure decoration), the loop sleeps while the tab is hidden, and+// prefers-reduced-motion downgrades the typing to a plain periodic swap.+// The first example ships fully typed in the markup so there is no pop-in.+const PROMPT_EXAMPLES = [+ 'a samurai in neon armor',+ 'a cozy robot librarian with brass glasses',+ 'a jade dragon-scaled warrior queen',+ 'an astronaut covered in koi tattoos',+ 'a Victorian ghost detective in a long coat',+ 'a desert nomad with a clockwork falcon',+ 'a street medic from a cyberpunk night market',+];++function startPromptExampleLoop() {+ const el = document.getElementById('card-prompt-example');+ if (!el) return;++ let index = 0;+ if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) {+ setInterval(() => {+ if (document.hidden) return;+ index = (index + 1) % PROMPT_EXAMPLES.length;+ el.textContent = PROMPT_EXAMPLES[index];+ }, 4000);+ return;+ }++ let chars = PROMPT_EXAMPLES[0].length;+ let phase = 'hold';+ const HOLD_MS = 2600;++ function tick() {+ if (document.hidden) {+ setTimeout(tick, 600);+ return;+ }+ let wait;+ if (phase === 'hold') {+ phase = 'erase';+ wait = HOLD_MS;+ } else if (phase === 'erase') {+ chars -= 1;+ el.textContent = PROMPT_EXAMPLES[index].slice(0, chars);+ if (chars <= 0) {+ index = (index + 1) % PROMPT_EXAMPLES.length;+ phase = 'type';+ wait = 350;+ } else {+ wait = 14 + Math.random() * 20;+ }+ } else {+ chars += 1;+ el.textContent = PROMPT_EXAMPLES[index].slice(0, chars);+ if (chars >= PROMPT_EXAMPLES[index].length) {+ phase = 'hold';+ wait = 60;+ } else {+ wait = 28 + Math.random() * 40;+ }+ }+ setTimeout(tick, wait);+ }+ // The 'hold' phase itself waits HOLD_MS, so enter the loop almost at once.+ setTimeout(tick, 60);+}+// Cards are divs with role="button", so we need to wire both click and// keyboard activation (Enter / Space) ourselves — native <button> semantics.function wireCard(id, handler) {diff --git a/src/dashboard-next/pages/home.js b/src/dashboard-next/pages/home.jsindex eb0e00138..3da57bd6c 100644--- a/src/dashboard-next/pages/home.js+++ b/src/dashboard-next/pages/home.js@@ -534,7 +534,6 @@ function renderForgeAnnounce(host) {</div><form class="dnx-forge-form" novalidate><label class="dnx-forge-field">- <span class="sr-only">Describe an object to forge into 3D</span><inputclass="dnx-forge-input"type="text"@@ -1484,43 +1483,204 @@ function injectStyles() {.dnx-activity-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.dnx-activity-time { color: var(--nxt-ink-fade); font-size: 12px; font-variant-numeric: tabular-nums; }- /* ── Launch announcement: text-to-3D ── */- .dnx-announce-wrap { margin-bottom: 16px; }- .dnx-announce {- display: flex; align-items: center; gap: 12px;- padding: 11px 14px;- border-radius: var(--nxt-radius-sm);+ /* ── Launch launchpad: text-to-3D ── */+ .dnx-announce-wrap { margin-bottom: 18px; }+ .dnx-forge {+ position: relative;+ display: flex;+ align-items: center;+ gap: 18px;+ padding: 16px 18px;+ border-radius: var(--nxt-radius);border: 1px solid var(--nxt-stroke-strong);- background: linear-gradient(90deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));+ background:+ radial-gradient(120% 140% at 0% 0%, rgba(255,255,255,0.07), transparent 60%),+ linear-gradient(180deg, rgba(20,21,28,0.72), rgba(12,13,18,0.55));+ overflow: hidden;+ isolation: isolate;+ }+ /* Top hairline shimmer — a slow light sweep that draws the eye to "new". */+ .dnx-forge::before {+ content: '';+ position: absolute; inset: 0 0 auto 0; height: 1px;+ background: linear-gradient(90deg, transparent, rgba(255,255,255,0.65), transparent);+ background-size: 40% 100%;+ background-repeat: no-repeat;+ animation: dnx-forge-sweep 5.5s ease-in-out infinite;+ z-index: 2;}- .dnx-announce-badge {+ @keyframes dnx-forge-sweep {+ 0% { background-position: -45% 0; }+ 55%, 100% { background-position: 145% 0; }+ }++ /* ── Animated mesh visual: wireframe cube + scan ring ── */+ .dnx-forge-visual {+ position: relative;+ flex-shrink: 0;+ width: 64px; height: 64px;+ display: grid; place-items: center;+ perspective: 340px;+ }+ .dnx-forge-ring {+ position: absolute; inset: -2px;+ border-radius: 50%;+ background: conic-gradient(from 0deg, transparent 0 62%, rgba(255,255,255,0.55) 84%, rgba(255,255,255,0.9) 92%, transparent 100%);+ -webkit-mask: radial-gradient(closest-side, transparent 76%, #000 78%);+ mask: radial-gradient(closest-side, transparent 76%, #000 78%);+ animation: dnx-forge-ring 4.2s linear infinite;+ opacity: 0.9;+ }+ @keyframes dnx-forge-ring { to { transform: rotate(360deg); } }+ .dnx-forge-stage {+ width: 34px; height: 34px;+ transform-style: preserve-3d;+ animation: dnx-forge-spin 9s linear infinite;+ }+ @keyframes dnx-forge-spin {+ from { transform: rotateX(-22deg) rotateY(0deg); }+ to { transform: rotateX(-22deg) rotateY(360deg); }+ }+ .dnx-forge-cube {+ position: relative;+ width: 34px; height: 34px;+ transform-style: preserve-3d;+ }+ .dnx-forge-cube i {+ position: absolute; inset: 0;+ border: 1px solid rgba(255,255,255,0.55);+ background: rgba(255,255,255,0.018);+ box-shadow: inset 0 0 12px rgba(255,255,255,0.06);+ }+ .dnx-forge-cube i:nth-child(1) { transform: rotateY(0deg) translateZ(17px); }+ .dnx-forge-cube i:nth-child(2) { transform: rotateY(90deg) translateZ(17px); }+ .dnx-forge-cube i:nth-child(3) { transform: rotateY(180deg) translateZ(17px); }+ .dnx-forge-cube i:nth-child(4) { transform: rotateY(270deg) translateZ(17px); }+ .dnx-forge-cube i:nth-child(5) { transform: rotateX(90deg) translateZ(17px); }+ .dnx-forge-cube i:nth-child(6) { transform: rotateX(-90deg) translateZ(17px); }+ .dnx-forge-scan {+ position: absolute; left: 8px; right: 8px; height: 1px;+ background: linear-gradient(90deg, transparent, rgba(255,255,255,0.85), transparent);+ filter: blur(0.3px);+ animation: dnx-forge-scan 2.8s ease-in-out infinite;+ z-index: 1;+ }+ @keyframes dnx-forge-scan {+ 0% { top: 14%; opacity: 0; }+ 18% { opacity: 1; }+ 82% { opacity: 1; }+ 100% { top: 86%; opacity: 0; }+ }+ .dnx-forge:hover .dnx-forge-stage { animation-duration: 5s; }+ .dnx-forge:hover .dnx-forge-ring { animation-duration: 2.6s; }++ /* ── Body: head + composer + chips ── */+ .dnx-forge-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; }+ .dnx-forge-head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }+ .dnx-forge-badge {flex-shrink: 0;padding: 2px 8px;border-radius: var(--nxt-radius-pill);border: 1px solid var(--nxt-stroke-strong);background: rgba(255,255,255,0.1);- font-size: 10.5px; font-weight: 700;- letter-spacing: 0.08em; text-transform: uppercase;+ font-size: 10px; font-weight: 700;+ letter-spacing: 0.09em; text-transform: uppercase;color: var(--nxt-ink);}- .dnx-announce-text {- flex: 1; min-width: 0; margin: 0;- font-size: 13px; color: var(--nxt-ink-dim);+ .dnx-forge-title { font-size: 15px; font-weight: 600; color: var(--nxt-ink); }+ .dnx-forge-sub { font-size: 12.5px; color: var(--nxt-ink-dim); }+ .dnx-forge-form { display: flex; gap: 8px; align-items: stretch; max-width: 560px; }+ .dnx-forge-field { flex: 1; min-width: 0; display: block; }+ .dnx-forge-input {+ width: 100%; height: 36px;+ padding: 0 13px;+ border-radius: var(--nxt-radius-sm);+ border: 1px solid var(--nxt-stroke-strong);+ background: rgba(0,0,0,0.35);+ color: var(--nxt-ink);+ font: inherit; font-size: 13.5px;+ transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;+ }+ .dnx-forge-input::placeholder { color: var(--nxt-ink-fade); }+ .dnx-forge-input:hover { border-color: rgba(255,255,255,0.22); }+ .dnx-forge-input:focus {+ outline: none;+ border-color: rgba(255,255,255,0.4);+ background: rgba(0,0,0,0.5);+ box-shadow: 0 0 0 3px rgba(255,255,255,0.07);+ }+ .dnx-forge-go {+ flex-shrink: 0;+ display: inline-flex; align-items: center; gap: 6px;+ height: 36px; padding: 0 15px;+ border-radius: var(--nxt-radius-sm);+ border: 1px solid transparent;+ background: var(--nxt-accent); color: #000;+ font: inherit; font-size: 13px; font-weight: 600;+ cursor: pointer;+ transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;+ }+ .dnx-forge-go:hover { background: #fff; box-shadow: 0 4px 18px -6px rgba(255,255,255,0.4); }+ .dnx-forge-go:active { transform: translateY(1px); }+ .dnx-forge-go svg { transition: transform 0.15s ease; }+ .dnx-forge-go:hover svg { transform: translateX(2px); }+ .dnx-forge-chips { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }+ .dnx-forge-chips-label { font-size: 11.5px; color: var(--nxt-ink-fade); }+ .dnx-forge-chip {+ padding: 3px 10px;+ border-radius: var(--nxt-radius-pill);+ border: 1px solid var(--nxt-stroke);+ background: rgba(255,255,255,0.03);+ color: var(--nxt-ink-dim);+ font-size: 11.5px; text-decoration: none;+ transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease, transform 0.12s ease;}- .dnx-announce-text strong { color: var(--nxt-ink); font-weight: 600; }- .dnx-announce-cta { flex-shrink: 0; font-size: 12px; padding: 5px 12px; white-space: nowrap; }- .dnx-announce-dismiss {+ .dnx-forge-chip:hover {+ color: var(--nxt-ink);+ border-color: var(--nxt-stroke-strong);+ background: rgba(255,255,255,0.07);+ transform: translateY(-1px);+ }+ .dnx-forge-chip:focus-visible,+ .dnx-forge-go:focus-visible,+ .dnx-forge-dismiss:focus-visible {+ outline: 2px solid var(--nxt-ink);+ outline-offset: 2px;+ }+ .dnx-forge-dismiss {+ position: absolute; top: 10px; right: 10px;background: none; border: none; cursor: pointer;color: var(--nxt-ink-fade); padding: 4px; border-radius: 6px;- display: grid; place-items: center; flex-shrink: 0;+ display: grid; place-items: center;transition: color 0.12s ease, background 0.12s ease;- }- .dnx-announce-dismiss:hover { color: var(--nxt-ink); background: rgba(255,255,255,0.06); }- @media (max-width: 600px) {- .dnx-announce { flex-wrap: wrap; }- .dnx-announce-text { flex-basis: 100%; order: 3; }- .dnx-announce-cta { order: 4; }- .dnx-announce-dismiss { margin-left: auto; order: 2; }+ z-index: 3;+ }+ .dnx-forge-dismiss:hover { color: var(--nxt-ink); background: rgba(255,255,255,0.06); }++ /* Reduced motion — kill every loop, keep the layout intact. */+ .dnx-forge.is-still::before,+ .dnx-forge.is-still .dnx-forge-ring,+ .dnx-forge.is-still .dnx-forge-stage,+ .dnx-forge.is-still .dnx-forge-scan { animation: none; }+ .dnx-forge.is-still .dnx-forge-stage { transform: rotateX(-22deg) rotateY(32deg); }+ .dnx-forge.is-still .dnx-forge-scan { opacity: 0; }+ @media (prefers-reduced-motion: reduce) {+ .dnx-forge::before,+ .dnx-forge .dnx-forge-ring,+ .dnx-forge .dnx-forge-stage,+ .dnx-forge .dnx-forge-scan { animation: none; }+ .dnx-forge .dnx-forge-stage { transform: rotateX(-22deg) rotateY(32deg); }+ .dnx-forge .dnx-forge-scan { opacity: 0; }+ }+ @media (max-width: 680px) {+ .dnx-forge { gap: 14px; padding: 14px; }+ .dnx-forge-visual { width: 52px; height: 52px; align-self: flex-start; }+ .dnx-forge-form { flex-wrap: wrap; }+ .dnx-forge-field { flex-basis: 100%; }+ .dnx-forge-go { flex: 1; justify-content: center; }+ }+ @media (max-width: 460px) {+ .dnx-forge-visual { display: none; }}/* ── Onboarding checklist ── */diff --git a/src/forge-dropzone.js b/src/forge-dropzone.jsnew file mode 100644index 000000000..2a1a68037--- /dev/null+++ b/src/forge-dropzone.js@@ -0,0 +1,226 @@+// Forge dropzone — paste or drop reference photos anywhere on /forge.+//+// Two capture paths, both routed through the `forge:add-images` hook in+// src/forge.js (which switches to the right input mode and distributes files+// into free view slots, or the sketch slot in sketch mode):+//+// • Paste (⌘V / Ctrl+V) — an image on the clipboard becomes a reference+// view from anywhere on the page. Text pastes into inputs are untouched.+// • Drag a file over the page — outside photo mode a full-page overlay+// invites the drop ("the slots aren't visible, so say where it goes");+// inside photo mode the slots already light up individually, so the only+// page-level job is catching drops that miss a slot instead of letting+// the browser navigate away to the image.+//+// Self-contained: injects its own styles, owns its overlay + toast nodes,+// talks to forge.js only via the CustomEvent contract.++const STYLE_ID = 'forge-dropzone-styles';+const IMAGE_TYPES = new Set(['image/png', 'image/jpeg', 'image/webp']);++function injectStyles() {+ if (document.getElementById(STYLE_ID)) return;+ const style = document.createElement('style');+ style.id = STYLE_ID;+ style.textContent = `+ .forge-drop-overlay {+ position: fixed;+ inset: 0;+ z-index: 80;+ display: grid;+ place-items: center;+ background: color-mix(in srgb, var(--bg, #0b0b10) 72%, transparent);+ backdrop-filter: blur(3px);+ -webkit-backdrop-filter: blur(3px);+ opacity: 0;+ pointer-events: none;+ transition: opacity 0.15s ease;+ }+ .forge-drop-overlay[data-active='true'] {+ opacity: 1;+ pointer-events: auto;+ }+ .forge-drop-card {+ display: flex;+ flex-direction: column;+ align-items: center;+ gap: 0.6rem;+ padding: 2.2rem 2.8rem;+ border: 2px dashed var(--accent, #7c9cff);+ border-radius: var(--radius-lg, 16px);+ background: var(--surface-1, rgba(255, 255, 255, 0.04));+ text-align: center;+ transform: scale(0.97);+ transition: transform 0.15s ease;+ }+ .forge-drop-overlay[data-active='true'] .forge-drop-card {+ transform: scale(1);+ }+ .forge-drop-card .glyph {+ font-size: 2rem;+ color: var(--accent, #7c9cff);+ line-height: 1;+ }+ .forge-drop-card h3 {+ margin: 0;+ color: var(--ink, #fff);+ font-family: var(--font-display, inherit);+ font-size: var(--text-lg, 1.1rem);+ }+ .forge-drop-card p {+ margin: 0;+ color: var(--ink-dim, #aab);+ font-size: var(--text-sm, 0.85rem);+ max-width: 34ch;+ }+ .forge-toast {+ position: fixed;+ left: 50%;+ bottom: 28px;+ transform: translate(-50%, 8px);+ z-index: 90;+ background: var(--surface-3, #1d1d26);+ border: 1px solid var(--stroke-strong, rgba(255, 255, 255, 0.16));+ border-radius: 999px;+ color: var(--ink, #fff);+ font-size: var(--text-sm, 0.85rem);+ padding: 0.55rem 1.1rem;+ box-shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.7);+ opacity: 0;+ pointer-events: none;+ transition: opacity 0.18s ease, transform 0.18s ease;+ }+ .forge-toast[data-show='true'] {+ opacity: 1;+ transform: translate(-50%, 0);+ }+ @media (prefers-reduced-motion: reduce) {+ .forge-drop-overlay, .forge-drop-card, .forge-toast {+ transition: none;+ }+ }+ `;+ document.head.appendChild(style);+}++// ── Toast ───────────────────────────────────────────────────────────────────++let toastEl = null;+let toastTimer = null;+function toast(message) {+ if (!toastEl) {+ toastEl = document.createElement('div');+ toastEl.className = 'forge-toast';+ toastEl.setAttribute('role', 'status');+ toastEl.setAttribute('aria-live', 'polite');+ document.body.appendChild(toastEl);+ }+ toastEl.textContent = message;+ toastEl.dataset.show = 'true';+ clearTimeout(toastTimer);+ toastTimer = setTimeout(() => {+ toastEl.dataset.show = 'false';+ }, 2600);+}++// ── Mode + file helpers ─────────────────────────────────────────────────────++function currentMode() {+ return (+ document.querySelector('#mode-switch [aria-selected="true"]')?.dataset.mode || 'text'+ );+}++function imageFilesOf(list) {+ return Array.from(list || []).filter((f) => f && IMAGE_TYPES.has(f.type));+}++function addImages(files, source) {+ if (!files.length) return;+ const sketch = currentMode() === 'sketch';+ document.dispatchEvent(new CustomEvent('forge:add-images', { detail: { files } }));+ if (sketch) {+ toast(`${source} added as your sketch`);+ } else {+ toast(+ files.length === 1+ ? `${source} added as a reference view`+ : `${files.length} photos added as reference views`,+ );+ }+}++// ── Paste ───────────────────────────────────────────────────────────────────++document.addEventListener('paste', (e) => {+ const files = imageFilesOf(e.clipboardData?.files);+ if (!files.length) return; // text paste — leave the browser alone+ e.preventDefault();+ addImages(files, 'Pasted image');+});++// ── Page-level drag & drop ──────────────────────────────────────────────────++let overlay = null;+function ensureOverlay() {+ if (overlay) return overlay;+ overlay = document.createElement('div');+ overlay.className = 'forge-drop-overlay';+ overlay.setAttribute('aria-hidden', 'true');+ overlay.innerHTML = `+ <div class="forge-drop-card">+ <span class="glyph" aria-hidden="true">⇣</span>+ <h3>Drop photos to forge in 3D</h3>+ <p>1–4 views of one object. I'll switch to <strong>From photos</strong> and place them for you.</p>+ </div>`;+ document.body.appendChild(overlay);+ return overlay;+}++function draggingFiles(e) {+ return Array.from(e.dataTransfer?.types || []).includes('Files');+}++// dragenter/leave fire for every child node — a depth counter is the reliable+// way to know when the pointer truly left the window.+let dragDepth = 0;+function setOverlay(active) {+ ensureOverlay().dataset.active = String(active);+}++document.addEventListener('dragenter', (e) => {+ if (!draggingFiles(e)) return;+ dragDepth++;+ // In photo mode the view slots are on screen and light up themselves; the+ // overlay would cover them and steal their per-slot targeting.+ if (currentMode() !== 'image') setOverlay(true);+});++document.addEventListener('dragleave', () => {+ dragDepth = Math.max(0, dragDepth - 1);+ if (dragDepth === 0) setOverlay(false);+});++document.addEventListener('dragover', (e) => {+ if (!draggingFiles(e)) return;+ // Without this the drop never fires and the browser navigates to the file.+ e.preventDefault();+});++document.addEventListener('drop', (e) => {+ dragDepth = 0;+ setOverlay(false);+ if (!draggingFiles(e)) return;+ e.preventDefault();+ // A drop directly on a view slot was already handled there (capture order:+ // slot listener runs first and reads the same event) — don't double-add.+ if (e.target instanceof Element && e.target.closest('.view-slot')) return;+ const files = imageFilesOf(e.dataTransfer.files);+ if (!files.length) {+ toast('Only PNG, JPG, or WebP images can become reference views');+ return;+ }+ addImages(files, 'Dropped photo');+});++injectStyles();diff --git a/src/forge-enhance.js b/src/forge-enhance.jsnew file mode 100644index 000000000..8c1dc030d--- /dev/null+++ b/src/forge-enhance.js@@ -0,0 +1,259 @@+// Forge prompt enhancer — the one AI-powered authoring aid in the text composer.+//+// "Surprise me" and the prompt coach (src/forge-prompt-studio.js) are curated,+// client-side helpers. This is the opposite: it takes whatever the user actually+// typed and rewrites it with a real model into a sharper, single-subject prompt+// shaped for the FLUX → TRELLIS pipeline (material, lighting and background cues+// the reconstructor reads cleanly). It runs on the site's free-first LLM chain+// via POST /api/forge-enhance, so it costs the visitor nothing and needs no key.+//+// Self-contained on purpose: it injects its own button into the existing+// #prompt-tools toolbar and owns its styles, so it composes with the rest of the+// composer without the page wiring it explicitly — the same pattern as+// forge-stylize.js and forge-optimize.js.++const prompt = document.getElementById('prompt');+const tools = document.getElementById('prompt-tools');+const anchor = document.getElementById('surprise'); // insert right after "Surprise me"++// No text composer on this render (page markup changed, or module loaded on the+// wrong page) — degrade to nothing rather than throw.+if (prompt && tools) {+ injectStyles();++ const btn = document.createElement('button');+ btn.type = 'button';+ btn.className = 'ptool ptool--ai';+ btn.id = 'enhance';+ btn.setAttribute('aria-label', 'Rewrite your prompt into a sharper, model-ready description');+ btn.title = 'Rewrite your prompt into a sharper, model-ready description';+ btn.innerHTML = `+ <svg class="enhance-spark" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">+ <path d="M12 2.5l1.9 5 5 1.9-5 1.9-1.9 5-1.9-5-5-1.9 5-1.9 1.9-5zM19 14l.85 2.15L22 17l-2.15.85L19 20l-.85-2.15L16 17l2.15-.85L19 14zM5.5 14.5l.7 1.8 1.8.7-1.8.7-.7 1.8-.7-1.8-1.8-.7 1.8-.7.7-1.8z"/>+ </svg>+ <span class="enhance-label">Enhance</span>`;++ const undo = document.createElement('button');+ undo.type = 'button';+ undo.className = 'ptool ptool--undo is-hidden';+ undo.id = 'enhance-undo';+ undo.textContent = 'Undo';+ undo.title = 'Restore the prompt you wrote';++ const note = document.createElement('p');+ note.className = 'enhance-note is-hidden';+ note.id = 'enhance-note';+ note.setAttribute('role', 'status');+ note.setAttribute('aria-live', 'polite');++ // Order: Surprise me → Enhance → Undo, then the rest of the toolbar.+ if (anchor && anchor.parentNode === tools) {+ anchor.after(btn, undo);+ } else {+ tools.prepend(undo);+ tools.prepend(btn);+ }+ tools.after(note);++ let prevPrompt = null; // the user's words before the last enhance, for Undo+ let busy = false;+ let selfEdit = false; // true while WE write to the textarea, so the input+ // listener below doesn't mistake our programmatic write for the user editing+ let noteTimer = null;++ function showNote(msg, kind = 'tip') {+ note.textContent = msg;+ note.dataset.kind = kind;+ note.classList.remove('is-hidden');+ clearTimeout(noteTimer);+ // Keep errors up a touch longer than neutral tips; never permanent.+ noteTimer = setTimeout(() => note.classList.add('is-hidden'), kind === 'error' ? 5200 : 3600);+ }++ function hideNote() {+ clearTimeout(noteTimer);+ note.classList.add('is-hidden');+ }++ // Write into the textarea and let the rest of the composer (coach + counter in+ // forge-prompt-studio.js, the submit guard in forge.js) react as if the user+ // typed it — one input event keeps every dependent feature in sync.+ function setPrompt(value, { flash = false } = {}) {+ selfEdit = true;+ prompt.value = value;+ prompt.dispatchEvent(new Event('input', { bubbles: true }));+ selfEdit = false;+ prompt.focus();+ try {+ prompt.setSelectionRange(value.length, value.length);+ } catch {+ /* setSelectionRange throws on some inputs — caret position is cosmetic */+ }+ if (flash) {+ prompt.classList.remove('enhance-flash');+ void prompt.offsetWidth; // restart the animation+ prompt.classList.add('enhance-flash');+ }+ }++ function setBusy(on) {+ busy = on;+ btn.disabled = on;+ btn.classList.toggle('is-working', on);+ btn.querySelector('.enhance-label').textContent = on ? 'Enhancing…' : 'Enhance';+ prompt.classList.toggle('is-enhancing', on);+ prompt.setAttribute('aria-busy', String(on));+ }++ async function enhance() {+ if (busy) return;+ const raw = prompt.value.trim();+ if (raw.length < 3) {+ prompt.focus();+ showNote('Describe the object in a few words first, then enhance it.', 'tip');+ return;+ }++ setBusy(true);+ hideNote();+ try {+ const res = await fetch('/api/forge-enhance', {+ method: 'POST',+ headers: { 'content-type': 'application/json' },+ body: JSON.stringify({ prompt: raw }),+ });++ if (res.status === 429) {+ const data = await res.json().catch(() => ({}));+ const secs = Number(data.retry_after);+ showNote(+ Number.isFinite(secs) && secs > 0+ ? `Easy — try enhancing again in ${secs}s.`+ : 'Slow down a moment, then try again.',+ 'error',+ );+ return;+ }+ if (res.status === 503) {+ showNote('The enhancer is offline right now — your prompt is unchanged.', 'error');+ return;+ }+ if (!res.ok) {+ showNote("Couldn't enhance that one. Try again, or tweak the wording.", 'error');+ return;+ }++ const data = await res.json();+ const next = typeof data.prompt === 'string' ? data.prompt.trim() : '';+ if (!next || next.toLowerCase() === raw.toLowerCase()) {+ showNote('That prompt is already in good shape.', 'tip');+ return;+ }++ prevPrompt = raw;+ setPrompt(next, { flash: true });+ undo.classList.remove('is-hidden');+ showNote('Rewritten for sharper geometry. Edit freely, or Undo.', 'strong');+ } catch {+ showNote('Network hiccup — your prompt is unchanged. Try again.', 'error');+ } finally {+ setBusy(false);+ }+ }++ btn.addEventListener('click', enhance);++ undo.addEventListener('click', () => {+ if (prevPrompt == null) return;+ setPrompt(prevPrompt);+ prevPrompt = null;+ undo.classList.add('is-hidden');+ hideNote();+ });++ // Once the user edits the prompt by hand, the previous-words snapshot is stale+ // — retire Undo so it can never restore something they didn't mean.+ prompt.addEventListener('input', () => {+ if (selfEdit) return;+ if (prevPrompt != null) {+ prevPrompt = null;+ undo.classList.add('is-hidden');+ }+ });++ // ⌘/Ctrl+E enhances without leaving the keyboard — pairs with the existing+ // ⌘/Ctrl+Enter to generate.+ prompt.addEventListener('keydown', (e) => {+ if ((e.metaKey || e.ctrlKey) && (e.key === 'e' || e.key === 'E')) {+ e.preventDefault();+ enhance();+ }+ });+}++function injectStyles() {+ if (document.getElementById('forge-enhance-styles')) return;+ const style = document.createElement('style');+ style.id = 'forge-enhance-styles';+ style.textContent = `+ .ptool--ai {+ color: var(--accent);+ border-color: color-mix(in srgb, var(--accent) 45%, var(--stroke));+ background: color-mix(in srgb, var(--accent) 8%, transparent);+ }+ .ptool--ai:hover {+ color: var(--accent);+ border-color: var(--accent);+ background: var(--accent-soft);+ }+ .ptool--ai .enhance-spark { width: 14px; height: 14px; }+ .ptool--ai.is-working { cursor: progress; }+ .ptool--ai.is-working .enhance-spark { animation: enhance-spin 0.9s linear infinite; transform-origin: 50% 50%; }+ .ptool--undo { color: var(--ink-dim); }+ .enhance-note {+ margin: var(--space-xs) 0 0;+ font-size: var(--text-xs);+ line-height: 1.45;+ color: var(--ink-dim);+ display: flex;+ align-items: center;+ gap: 0.45rem;+ }+ .enhance-note::before {+ content: '';+ width: 6px; height: 6px; border-radius: 50%;+ background: var(--accent); flex: none;+ }+ .enhance-note[data-kind='strong'] { color: var(--success); }+ .enhance-note[data-kind='strong']::before { background: var(--success); box-shadow: 0 0 8px var(--success); }+ .enhance-note[data-kind='error'] { color: var(--danger); }+ .enhance-note[data-kind='error']::before { background: var(--danger); }+ .enhance-note.is-hidden { display: none; }+ #prompt.is-enhancing {+ background-image: linear-gradient(+ 100deg,+ transparent 30%,+ color-mix(in srgb, var(--accent) 14%, transparent) 50%,+ transparent 70%+ );+ background-size: 220% 100%;+ background-repeat: no-repeat;+ animation: enhance-sheen 1.15s linear infinite;+ border-radius: var(--radius-sm);+ }+ #prompt.enhance-flash { animation: enhance-flash 0.7s ease; }+ @keyframes enhance-spin { to { transform: rotate(360deg); } }+ @keyframes enhance-sheen { to { background-position: -220% 0; } }+ @keyframes enhance-flash {+ 0% { box-shadow: 0 0 0 0 var(--accent-soft); }+ 40% { box-shadow: 0 0 0 4px var(--accent-soft); }+ 100% { box-shadow: 0 0 0 0 transparent; }+ }+ @media (prefers-reduced-motion: reduce) {+ .ptool--ai.is-working .enhance-spark,+ #prompt.is-enhancing,+ #prompt.enhance-flash { animation: none; }+ }+ `;+ document.head.appendChild(style);+}diff --git a/src/forge-prompt-studio.js b/src/forge-prompt-studio.jsnew file mode 100644index 000000000..8f818fd6d--- /dev/null+++ b/src/forge-prompt-studio.js@@ -0,0 +1,264 @@+// Forge prompt studio — the text-mode authoring aids that sit under the+// composer: a curated prompt library behind "Surprise me" and "More ideas",+// a live prompt coach that grades what you typed against how the model+// actually reconstructs, and an honest character counter.+//+// All client-side. The library is hand-authored product content (single+// isolated subjects with material/lighting cues — the shape Forge meshes+// cleanest), not sampled data, and nothing here fakes a network call.++const MAXLEN = 1000;++// Curated starters — every one is a single, isolated object with a material+// and/or lighting cue, mirroring the guidance in the Forge FAQ. Grouped only+// for authoring clarity; consumed as one flat pool.+const LIBRARY = [+ // Creatures & characters+ 'a low-poly red fox, sitting, soft studio light',+ 'a chubby axolotl, glossy pink skin, plain background',+ 'a tiny brass clockwork owl, polished metal',+ 'a stone golem, mossy granite, weathered',+ 'a cartoon astronaut, matte white suit, neutral pose',+ 'a porcelain rabbit figurine, glazed, soft shadows',+ 'a wooden articulated artist mannequin, light oak',+ 'a plush felt dinosaur toy, stitched seams',+ // Props & objects+ 'a vintage film camera, brushed aluminium and black leather',+ 'a glazed ceramic teapot, cobalt blue, studio lighting',+ 'a worn leather armchair, studio lighting, plain background',+ 'an antique brass compass, weathered patina',+ 'a mechanical keyboard, translucent keycaps, backlit',+ 'a hand-forged iron axe, dark steel, leather grip',+ 'a crystal perfume bottle, faceted glass, gold cap',+ 'a retro rotary telephone, cream bakelite',+ 'a stack of hardcover books, aged cloth binding',+ 'a wireless over-ear headphone, matte charcoal',+ 'a single running shoe, knit upper, rubber sole',+ 'a brass desk lamp, articulated arm, enamel shade',+ 'a treasure chest, dark wood and tarnished iron bands',+ 'an espresso machine, stainless steel and chrome',+ // Nature & food+ 'a potted monstera plant, terracotta pot',+ 'a bonsai juniper in a shallow stone tray',+ 'a glazed donut with sprinkles, soft studio light',+ 'a ripe pomegranate, split open, glossy seeds',+ 'a cluster of amethyst crystals on raw rock',+ 'a single autumn maple leaf, deep amber',+ 'a honey jar with wooden dipper, warm light',+ 'a coral fan, calcified white, plain background',+ // Sci-fi & fantasy+ 'a sci-fi combat helmet, brushed metal, scuffed paint',+ 'a glowing mana potion in a corked vial, teal liquid',+ 'a hovering recon drone, white plastic and carbon fibre',+ 'a wizard staff, gnarled oak with an embedded gem',+ 'a retro ray gun, chrome with red accents',+ 'an enchanted spellbook, leather cover, brass clasp',+ 'a modular space station segment, white panels',+ 'a knight helm, dark polished steel, plumed crest',+ // Vehicles & architecture+ 'a low-poly camper van, pastel teal paint',+ 'a wooden sailboat model, white canvas sails',+ 'a vintage scooter, mint green, chrome trim',+ 'a small lighthouse, red and white stripes',+ 'a cozy mushroom cottage, thatched roof',+ 'a hot air balloon, striped canvas, wicker basket',+];++const $ = (id) => document.getElementById(id);++const els = {+ prompt: $('prompt'),+ surprise: $('surprise'),+ coach: $('prompt-coach'),+ count: $('prompt-count'),+ examples: $('examples'),+ chipsMore: $('chips-more'),+};++// Heuristic lexicons used by the coach. These describe how TRELLIS-style+// reconstruction behaves: a named material/finish and a clean isolated+// subject produce the sharpest mesh; scenes and multi-object prompts+// compress poorly into a single mesh.+const MATERIAL_WORDS = [+ 'metal',+ 'metallic',+ 'brass',+ 'bronze',+ 'copper',+ 'steel',+ 'iron',+ 'chrome',+ 'aluminium',+ 'aluminum',+ 'gold',+ 'silver',+ 'ceramic',+ 'porcelain',+ 'glazed',+ 'glass',+ 'crystal',+ 'wood',+ 'wooden',+ 'oak',+ 'leather',+ 'plastic',+ 'rubber',+ 'matte',+ 'glossy',+ 'polished',+ 'brushed',+ 'velvet',+ 'felt',+ 'stone',+ 'marble',+ 'granite',+ 'concrete',+ 'fabric',+ 'knit',+ 'enamel',+ 'carbon fibre',+ 'carbon fiber',+ 'bakelite',+ 'terracotta',+ 'weathered',+ 'rusted',+ 'patina',+];+const LIGHT_WORDS = ['studio', 'lighting', 'light', 'backlit', 'soft shadows', 'soft light', 'neutral'];+// Signals that the prompt is asking for a scene rather than one object.+const SCENE_WORDS = [+ 'scene',+ 'landscape',+ 'environment',+ 'diorama',+ 'room',+ 'interior',+ 'forest',+ 'city',+ 'street',+ 'battlefield',+ 'background of',+ 'surrounded by',+];++function hasAny(text, words) {+ return words.some((w) => text.includes(w));+}++// Count subjects loosely — an " and " joining two nouns, or several+// comma-separated clauses, both push the model toward a multi-object mesh.+function looksMultiSubject(text) {+ if (hasAny(text, SCENE_WORDS)) return true;+ if (/\b(two|three|four|several|a group of|a pair of|a set of)\b/.test(text)) return true;+ // " x and y " where both sides carry a noun-ish token.+ if (/\w+\s+and\s+\w+/.test(text) && !/black and white|red and white|salt and pepper/.test(text))+ return true;+ return false;+}++function grade(raw) {+ const text = raw.trim().toLowerCase();+ const words = text ? text.split(/\s+/).length : 0;++ if (!text) {+ return {+ grade: 'tip',+ msg: 'Name one object and a material — e.g. “a brass compass, weathered”.',+ };+ }+ if (words < 2) {+ return { grade: 'tip', msg: 'Add a little detail — a material, colour, or finish.' };+ }+ if (looksMultiSubject(text)) {+ return {+ grade: 'warn',+ msg: 'One isolated object reconstructs cleanest — scenes and multiple subjects compress poorly.',+ };+ }+ const material = hasAny(text, MATERIAL_WORDS);+ const light = hasAny(text, LIGHT_WORDS);+ if (material && light) {+ return { grade: 'strong', msg: 'Strong prompt — clear subject, material and lighting cues.' };+ }+ if (material) {+ return { grade: 'strong', msg: 'Good prompt — add “studio lighting” for an even cleaner bake.' };+ }+ return {+ grade: 'tip',+ msg: 'Add a material or finish — “matte ceramic”, “brushed brass” — for a sharper mesh.',+ };+}++function updateCoach() {+ if (!els.prompt) return;+ const value = els.prompt.value;+ if (els.coach) {+ const { grade: g, msg } = grade(value);+ els.coach.dataset.grade = g;+ els.coach.textContent = msg;+ }+ if (els.count) {+ const len = value.length;+ els.count.textContent = `${len} / ${MAXLEN}`;+ els.count.dataset.near = String(len >= MAXLEN - 100);+ }+}++// Random pick(s) from the library, avoiding a given set of current values so+// "Surprise me" and "More ideas" never echo what is already on screen.+function pickDistinct(count, avoid = new Set()) {+ const pool = LIBRARY.filter((p) => !avoid.has(p));+ const out = [];+ while (out.length < count && pool.length) {+ const i = Math.floor(Math.random() * pool.length);+ out.push(pool.splice(i, 1)[0]);+ }+ return out;+}++function surprise() {+ if (!els.prompt) return;+ const [pick] = pickDistinct(1, new Set([els.prompt.value.trim()]));+ if (!pick) return;+ els.prompt.value = pick;+ updateCoach();+ els.prompt.focus();+ const end = els.prompt.value.length;+ els.prompt.setSelectionRange(end, end);+ els.surprise?.classList.remove('is-rolling');+ // reflow so the animation restarts on rapid clicks+ void els.surprise?.offsetWidth;+ els.surprise?.classList.add('is-rolling');+}++function shuffleChips() {+ if (!els.examples) return;+ const chips = [...els.examples.querySelectorAll('.chip')];+ if (!chips.length) return;+ const current = new Set(chips.map((c) => c.textContent.trim()));+ const fresh = pickDistinct(chips.length, current);+ chips.forEach((chip, i) => {+ const next = fresh[i];+ if (!next) return;+ chip.classList.add('is-swapping');+ });+ const swap = () => {+ chips.forEach((chip, i) => {+ if (fresh[i]) chip.textContent = fresh[i];+ chip.classList.remove('is-swapping');+ });+ };+ if (window.matchMedia?.('(prefers-reduced-motion: reduce)').matches) swap();+ else setTimeout(swap, 180);+ els.chipsMore?.classList.remove('is-rolling');+ void els.chipsMore?.offsetWidth;+ els.chipsMore?.classList.add('is-rolling');+}++if (els.prompt) {+ els.prompt.addEventListener('input', updateCoach);+ els.surprise?.addEventListener('click', surprise);+ els.chipsMore?.addEventListener('click', shuffleChips);+ // Reflect any value already present (remix ?prompt= prefill, restored draft).+ updateCoach();+}diff --git a/src/forge-showcase.js b/src/forge-showcase.jsnew file mode 100644index 000000000..cb28ac61f--- /dev/null+++ b/src/forge-showcase.js@@ -0,0 +1,164 @@+// Forge community showcase — "Fresh from the Forge".+//+// Renders the newest finished models across all Forge users into the+// #showcase section on /forge (GET /api/forge-gallery?scope=community).+// Two affordances per card:+// • click the card → opens the model in the page's main viewer via the+// `forge:open-creation` hook in src/forge.js, so the full result bar+// (download, share, stylize, optimize, split) works on it+// • Remix → copies the creation's prompt into the composer and+// focuses it, so a visitor starts from something that demonstrably works+//+// The section stays hidden when the deployment has no durable store or the+// feed is empty — a first-time visitor never sees a broken or hollow strip.++import { skeletonHTML, errorStateHTML, ensureStateKitStyles } from './shared/state-kit.js';+ensureStateKitStyles();++const ENGINE_LABELS = { nvidia: 'Free', trellis: 'Fast', meshy: 'Meshy', tripo: 'Tripo', hunyuan3d: 'Hunyuan3D', triposg: 'TripoSG' };++const els = {+ section: document.getElementById('showcase'),+ grid: document.getElementById('showcase-grid'),+ count: document.getElementById('showcase-count'),+ refresh: document.getElementById('showcase-refresh'),+};++// "3m ago" / "2h ago" / "5d ago" — compact, no library.+function timeAgo(iso) {+ const t = Date.parse(iso);+ if (!Number.isFinite(t)) return '';+ const s = Math.max(0, (Date.now() - t) / 1000);+ if (s < 60) return 'just now';+ if (s < 3600) return `${Math.floor(s / 60)}m ago`;+ if (s < 86400) return `${Math.floor(s / 3600)}h ago`;+ return `${Math.floor(s / 86400)}d ago`;+}++function buildCard(c) {+ const card = document.createElement('div');+ card.className = 'creation showcase-card';+ card.tabIndex = 0;+ card.setAttribute('role', 'button');+ card.title = c.prompt || 'Forged model';+ card.setAttribute('aria-label', `Open in viewer: ${c.prompt || 'forged model'}`);++ if (c.preview_image_url) {+ const img = document.createElement('img');+ img.className = 'thumb';+ img.loading = 'lazy';+ img.alt = '';+ img.src = c.preview_image_url;+ card.appendChild(img);+ } else {+ const ph = document.createElement('span');+ ph.className = 'thumb placeholder';+ ph.textContent = '◳';+ card.appendChild(ph);+ }++ // Engine · tier provenance, same convention as "Your creations".+ if (c.backend || c.tier) {+ const prov = document.createElement('span');+ prov.className = 'badge';+ prov.style.left = '6px';+ prov.style.right = 'auto';+ prov.textContent = [ENGINE_LABELS[c.backend] || c.backend, c.tier].filter(Boolean).join(' ');+ card.appendChild(prov);+ }+ if (Number(c.views_used) > 1) {+ const mv = document.createElement('span');+ mv.className = 'badge';+ mv.textContent = `${c.views_used}×`;+ mv.title = `${c.views_used} reference views`;+ card.appendChild(mv);+ }++ const meta = document.createElement('span');+ meta.className = 'meta';+ meta.textContent = c.prompt || 'Untitled';+ card.appendChild(meta);++ const when = document.createElement('span');+ when.className = 'showcase-when';+ when.textContent = timeAgo(c.created_at);+ card.appendChild(when);++ // Remix — only meaningful when there is a prompt to start from.+ if (c.prompt) {+ const remix = document.createElement('button');+ remix.type = 'button';+ remix.className = 'showcase-remix';+ remix.textContent = 'Remix';+ remix.title = 'Copy this prompt into the composer';+ remix.setAttribute('aria-label', `Remix prompt: ${c.prompt}`);+ remix.addEventListener('click', (e) => {+ e.stopPropagation();+ remixPrompt(c.prompt);+ });+ card.appendChild(remix);+ }++ const open = () =>+ document.dispatchEvent(new CustomEvent('forge:open-creation', { detail: { creation: c } }));+ card.addEventListener('click', open);+ card.addEventListener('keydown', (e) => {+ if (e.key === 'Enter' || e.key === ' ') {+ e.preventDefault();+ open();+ }+ });++ return card;+}++// Put the prompt in the composer, in text mode, ready to edit-and-Generate.+function remixPrompt(prompt) {+ document.querySelector('#mode-switch [data-mode="text"]')?.click();+ const box = document.getElementById('prompt');+ if (!box) return;+ box.value = prompt;+ box.dispatchEvent(new Event('input', { bubbles: true }));+ box.focus();+ // Caret at the end — the natural place to start tweaking.+ box.setSelectionRange(box.value.length, box.value.length);+ box.scrollIntoView({ behavior: 'smooth', block: 'center' });+}++async function loadShowcase() {+ if (!els.section || !els.grid) return;++ els.grid.setAttribute('aria-busy', 'true');+ els.grid.innerHTML = skeletonHTML(4, 'card');+ els.section.classList.remove('is-hidden');++ let data;+ try {+ const res = await fetch('/api/forge-gallery?scope=community&limit=12');+ data = await res.json().catch(() => ({}));+ } catch {+ els.grid.removeAttribute('aria-busy');+ els.grid.innerHTML = errorStateHTML({+ title: "Couldn't load the community feed",+ body: 'Check your connection and retry — generation itself is unaffected.',+ });+ els.grid.querySelector('[data-sk-retry]')?.addEventListener('click', loadShowcase);+ return;+ }++ els.grid.removeAttribute('aria-busy');+ const creations = Array.isArray(data?.creations) ? data.creations : [];+ if (!data?.enabled || creations.length === 0) {+ // No durable store, or nothing forged yet — no hollow strip.+ els.section.classList.add('is-hidden');+ return;+ }++ els.grid.innerHTML = '';+ for (const c of creations) els.grid.appendChild(buildCard(c));+ if (els.count) els.count.textContent = `${creations.length} recent`;+}++els.refresh?.addEventListener('click', loadShowcase);++loadShowcase();diff --git a/src/forge.js b/src/forge.jsindex 3e0cfaf8f..011f364e1 100644--- a/src/forge.js+++ b/src/forge.js@@ -84,6 +84,13 @@ const els = {byokHint: document.getElementById('byok-hint'),providerKey: document.getElementById('provider-key'),estimate: document.getElementById('estimate'),+ // Prompt tools (surprise · live coach · counter) + example swap + drop overlay.+ surprise: document.getElementById('surprise'),+ chipsMore: document.getElementById('chips-more'),+ promptCount: document.getElementById('prompt-count'),+ promptCoach: document.getElementById('prompt-coach'),+ composerDrop: document.getElementById('composer-drop'),+ genKbd: document.querySelector('.gen-kbd'),};let aspectRatio = '1:1';@@ -322,6 +329,7 @@ async function loadCatalog() {return;}buildEngineButtons();+ paintTierSublabels();selectTier(selectedTier);revealSketchMode();loadHealth();@@ -507,6 +515,148 @@ function updateEstimate() {els.estimate.innerHTML = parts.join(' · ');}+// Tier sublabels — paint each Quality button with the poly budget + a one-word+// intent ("12k · fast"), sourced from the live catalog so the trade-off between+// the three tiers is legible before you click one. No catalog → buttons keep+// their plain labels.+const TIER_INTENT = { draft: 'fast', standard: 'balanced', high: 'PBR' };+function paintTierSublabels() {+ if (!els.tier || !catalog?.tiers) return;+ for (const btn of els.tier.querySelectorAll('button[data-tier]')) {+ const t = catalog.tiers.find((x) => x.id === btn.dataset.tier);+ let sub = btn.querySelector('.tier-sub');+ if (!sub) {+ sub = document.createElement('small');+ sub.className = 'tier-sub';+ btn.appendChild(sub);+ }+ if (!t) {+ sub.textContent = '';+ continue;+ }+ const bits = [];+ if (Number(t.polycount) > 0) bits.push(`${Math.round(t.polycount / 1000)}k`);+ bits.push(TIER_INTENT[t.id] || '');+ sub.textContent = bits.filter(Boolean).join(' · ');+ }+}++// Prompt tools — curated idea pool, live counter, and an honest quality coach.+// The pool feeds both "Surprise me" (fill the box) and "More ideas" (swap the+// visible example chips). Every prompt is a single, clearly-described object —+// the shape that actually reconstructs well — so the tools teach by example.+const PROMPT_POOL = [+ 'a low-poly red fox, sitting',+ 'a sci-fi combat helmet, brushed metal',+ 'a potted monstera plant',+ 'a vintage film camera',+ 'a glazed ceramic teapot',+ 'a worn leather armchair, studio lighting',+ 'a low-poly treasure chest, iron-banded wood',+ 'a mid-century walnut sideboard, brass legs',+ 'a steampunk submarine, riveted brass',+ 'a cartoon robot, white and orange plastic',+ 'a chibi dragon, green scales, small wings',+ 'a medieval round shield, painted wood with steel rim',+ 'a stoneware coffee mug, speckled glaze',+ 'a minimalist desk lamp, matte black metal',+ 'a glazed donut, pink frosting, rainbow sprinkles',+ 'a tiny fantasy cottage, thatched roof',+ 'a low-poly lighthouse, red and white stripes',+ 'a brass steampunk owl',+ 'a cast-iron skillet',+ 'a neon arcade cabinet',+ 'a velvet wingback chair, deep green',+ 'a marble bust on a plinth',+ 'a retro rotary telephone, cherry red',+ 'a frosted glass perfume bottle',+ 'a samurai helmet, lacquered black',+ 'a knitted wool beanie',+];++// Material + style vocabulary the coach rewards — naming either is what lifts a+// prompt from vague to reconstructable.+const MATERIAL_RE =+ /\b(leather|metal|metallic|brushed|steel|iron|brass|copper|gold|silver|chrome|wood(en)?|oak|walnut|maple|bamboo|ceramic|glazed|porcelain|stoneware|plastic|matte|glossy|gloss|glass|frosted|stone|marble|granite|concrete|fabric|cloth|velvet|denim|wool|knitted|woven|rubber|clay|terracotta|bronze|carbon|lacquered|enamel|chrome)\b/i;+const STYLE_RE =+ /\b(low-?poly|realistic|photoreal\w*|cartoon|styli[sz]ed|voxel|sci-?fi|steampunk|minimalist|isometric|pixel|chibi|toy|retro|neon|fantasy|cyberpunk)\b/i;++// Live, honest prompt coach + character counter. Heuristics only — they read+// the text the user actually typed and never block submission; they nudge.+function updatePromptMeta() {+ if (!els.prompt) return;+ const raw = els.prompt.value;+ if (els.promptCount) {+ els.promptCount.textContent = `${raw.length} / 1000`;+ els.promptCount.dataset.near = String(raw.length >= 900);+ }+ if (!els.promptCoach) return;+ const t = raw.trim();+ const words = t ? t.split(/\s+/).length : 0;+ let grade = 'tip';+ let msg = 'Describe one object and what it’s made of.';+ if (t.length === 0) {+ grade = 'tip';+ msg = 'Describe one object and what it’s made of.';+ } else if (t.length < 8 || words < 2) {+ grade = 'warn';+ msg = 'A little short — add a detail or a material.';+ } else if (MATERIAL_RE.test(t) || STYLE_RE.test(t)) {+ grade = 'strong';+ msg = 'Strong prompt — clear subject and look.';+ } else {+ grade = 'tip';+ msg = 'Tip: name a material (leather, brushed metal, ceramic).';+ }+ els.promptCoach.dataset.grade = grade;+ els.promptCoach.textContent = msg;+}++// "Surprise me" — drop a random pool prompt into the box (never the one already+// there), spin the die, and focus so the user can tweak before forging.+function surprisePrompt() {+ if (!els.prompt) return;+ const current = els.prompt.value.trim();+ let pick = current;+ for (let i = 0; i < 8 && pick === current; i++) {+ pick = PROMPT_POOL[Math.floor(Math.random() * PROMPT_POOL.length)];+ }+ setMode('text');+ els.prompt.value = pick;+ updatePromptMeta();+ if (els.surprise) {+ els.surprise.classList.add('is-rolling');+ setTimeout(() => els.surprise.classList.remove('is-rolling'), 520);+ }+ els.prompt.focus();+}++// "More ideas" — swap the five visible example chips for the next window of the+// pool, with a quick fade so the change registers.+let chipOffset = 0;+function swapExampleChips() {+ if (!els.examples) return;+ const chips = Array.from(els.examples.querySelectorAll('.chip'));+ if (!chips.length) return;+ chipOffset = (chipOffset + chips.length) % PROMPT_POOL.length;+ if (els.chipsMore) {+ els.chipsMore.classList.add('is-rolling');+ setTimeout(() => els.chipsMore.classList.remove('is-rolling'), 480);+ }+ const apply = () => {+ chips.forEach((c, i) => {+ c.textContent = PROMPT_POOL[(chipOffset + i) % PROMPT_POOL.length];+ c.classList.remove('is-swapping');+ });+ };+ if (REDUCED_MOTION) {+ apply();+ return;+ }+ chips.forEach((c) => c.classList.add('is-swapping'));+ setTimeout(apply, 190);+}+// View slots ------------------------------------------------------------------function buildSlots() {@@ -1469,14 +1619,23 @@ els.aspect.addEventListener('click', (e) => {});els.examples.addEventListener('click', (e) => {+ if (e.target.closest('#chips-more')) {+ swapExampleChips();+ return;+ }const chip = e.target.closest('.chip');if (!chip) return;setMode('text');els.prompt.value = chip.textContent.trim();+ updatePromptMeta();els.prompt.focus();submit();});+// Prompt tools: live counter + coach, surprise fill.+els.prompt.addEventListener('input', updatePromptMeta);+els.surprise?.addEventListener('click', surprisePrompt);+// Quality tier + engine + BYOK key wiring.els.tier?.addEventListener('click', (e) => {const btn = e.target.closest('button[data-tier]');@@ -1584,6 +1743,65 @@ if (els.forgeShareBtn) {});}+// Drop a photo anywhere on the page, or paste one from the clipboard, to jump+// straight into multi-view reconstruction. Both routes reuse the same upload+// path as the slots — no new backend, just a faster on-ramp.+function imagesFromDataTransfer(list) {+ return Array.from(list || []).filter((f) => f && f.type && f.type.startsWith('image/'));+}++let dragDepth = 0;+function dragCarriesFiles(e) {+ return Array.from(e.dataTransfer?.types || []).includes('Files');+}+window.addEventListener('dragenter', (e) => {+ if (!dragCarriesFiles(e)) return;+ dragDepth += 1;+ els.form?.classList.add('is-drop-active');+});+window.addEventListener('dragover', (e) => {+ if (dragCarriesFiles(e)) e.preventDefault();+});+window.addEventListener('dragleave', (e) => {+ if (!dragCarriesFiles(e)) return;+ dragDepth = Math.max(0, dragDepth - 1);+ if (dragDepth === 0) els.form?.classList.remove('is-drop-active');+});+window.addEventListener('drop', (e) => {+ dragDepth = 0;+ els.form?.classList.remove('is-drop-active');+ // A drop that lands on a view slot is owned by that slot's own handler.+ if (e.target.closest?.('.view-slot')) return;+ const imgs = imagesFromDataTransfer(e.dataTransfer?.files);+ if (!imgs.length) return;+ e.preventDefault();+ setMode('image');+ handleFiles(null, imgs);+});++// Paste an image (screenshot, copied product photo) → photo mode + upload. Text+// pastes carry no image files, so normal typing/paste is never intercepted.+window.addEventListener('paste', (e) => {+ const items = e.clipboardData?.items;+ if (!items) return;+ const files = [];+ for (const it of items) {+ if (it.kind === 'file' && it.type.startsWith('image/')) {+ const f = it.getAsFile();+ if (f) files.push(f);+ }+ }+ if (!files.length) return;+ e.preventDefault();+ setMode('image');+ handleFiles(null, files);+});++// The ⌘↵ hint is rendered for macOS; everywhere else the submit chord is Ctrl↵.+if (els.genKbd && !/Mac|iPhone|iPad/i.test(navigator.platform || navigator.userAgent || '')) {+ els.genKbd.textContent = 'Ctrl↵';+}+// Handle ?prompt= (pre-fill from a remix link) and ?share= (open a creation).(function handleQueryParams() {const params = new URLSearchParams(location.search);@@ -1599,6 +1817,34 @@ if (els.forgeShareBtn) {}})();+// Paint the counter + coach for whatever the box starts with (remix prefill or+// empty), so the tools are live from first render.+updatePromptMeta();++// Hooks for the companion modules (forge-dropzone.js, forge-showcase.js) —+// a CustomEvent contract keeps them decoupled from this file's internals.++// Images captured anywhere on the page (clipboard paste, page-level drop).+// In sketch mode a single image becomes the sketch; otherwise we switch to+// photo mode and distribute into free view slots.+document.addEventListener('forge:add-images', (e) => {+ const files = Array.isArray(e.detail?.files) ? e.detail.files : [];+ if (!files.length) return;+ if (mode === 'sketch' && files.length === 1) {+ uploadSketch(files[0]);+ return;+ }+ if (mode !== 'image') setMode('image');+ handleFiles(null, files);+});++// A community-showcase card asks to open its creation in the main viewer, so+// the full result bar (download, share, stylize, optimize, split) works on it.+document.addEventListener('forge:open-creation', (e) => {+ const creation = e.detail?.creation;+ if (creation?.glb_url) openCreation(creation);+});+// Build the quality/engine controls from the live catalog (tiers, backends,// cost/time matrix). Falls back silently to the defaults if it can't load.loadCatalog();diff --git a/src/home-forge.js b/src/home-forge.jsindex 0b12893c1..9084a24b9 100644--- a/src/home-forge.js+++ b/src/home-forge.js@@ -12,13 +12,19 @@// Presentation: the section is a single state-reactive "chamber" —// [data-hf-state] on the chamber root drives the ring/floor/telemetry CSS.// This module adds the typewriter suggestion (Tab accepts), pointer parallax-// on the ambient layers, and the scanline + materialize reveal on results.+// on the ambient layers, the scanline + materialize reveal on results, a+// session history rail (real frames captured from the viewer, persisted on+// this device), and a wired result toolbar that carries the model straight+// into Scene Studio, a shareable link, a same-prompt variation, or download.// All motion respects prefers-reduced-motion.const POLL_INTERVAL_MS = 2500;const MAX_POLL_MS = 5 * 60 * 1000;const MODEL_VIEWER_SRC ='https://ajax.googleapis.com/ajax/libs/model-viewer/4.0.0/model-viewer.min.js';+const HISTORY_KEY = 'forge:home:history';+const HISTORY_MAX = 6;+const THUMB_SIZE = 96;const root = document.getElementById('home-forge');@@ -43,13 +49,21 @@ const els = root && {},elapsed: root.querySelector('[data-hf-elapsed]'),cancel: root.querySelector('[data-hf-cancel]'),+ resultRegion: root.querySelector('[data-hf-result-region]'),resultMeta: root.querySelector('[data-hf-result-meta]'),+ spin: root.querySelector('[data-hf-spin]'),+ vary: root.querySelector('[data-hf-vary]'),+ scene: root.querySelector('[data-hf-scene]'),+ share: root.querySelector('[data-hf-share]'),download: root.querySelector('[data-hf-download]'),again: root.querySelector('[data-hf-again]'),errorMessage: root.querySelector('[data-hf-error-message]'),retry: root.querySelector('[data-hf-retry]'),viewerSlot: root.querySelector('[data-hf-viewer-slot]'),scan: root.querySelector('[data-hf-scan]'),+ history: root.querySelector('[data-hf-history]'),+ historyTrack: root.querySelector('[data-hf-history-track]'),+ toast: root.querySelector('[data-hf-toast]'),};// Same anonymous handle as src/forge.js — keep the storage key in sync so the@@ -80,6 +94,9 @@ let pollAbort = false;let elapsedTimer = null;let lastPrompt = '';let modelViewerReady = null;+let currentViewer = null; // the live <model-viewer> on stage+let currentGlbUrl = ''; // what the toolbar acts on+let toastTimer = null;// Monotonic run token: cancel-then-regenerate must not let the first run's// poll loop wake up and fight the new one over the shared stage.let runSeq = 0;@@ -138,6 +155,7 @@ function setBusy(b) {busy = b;els.generate.disabled = b;els.generateLabel.textContent = b ? 'Forging…' : 'Forge';+ if (els.vary) els.vary.disabled = b;}function showError(message) {@@ -146,6 +164,127 @@ function showError(message) {showState('error');}+function showToast(message) {+ if (!els.toast) return;+ els.toast.textContent = message;+ els.toast.hidden = false;+ // Reflow so the .is-on transition runs even on a rapid second copy.+ void els.toast.offsetWidth;+ els.toast.classList.add('is-on');+ clearTimeout(toastTimer);+ toastTimer = setTimeout(() => {+ els.toast.classList.remove('is-on');+ setTimeout(() => {+ if (!els.toast.classList.contains('is-on')) els.toast.hidden = true;+ }, 240);+ }, 1800);+}++// ── Session history ────────────────────────────────────────────────+// Each entry: { glbUrl, prompt, thumb (data URL | null), ts }. Persisted on+// this device so a visitor's recent forges survive a scroll-away or reload.++function loadHistory() {+ try {+ const raw = JSON.parse(localStorage.getItem(HISTORY_KEY));+ return Array.isArray(raw) ? raw.filter((it) => it && it.glbUrl) : [];+ } catch {+ return [];+ }+}++function saveHistory(list) {+ try {+ localStorage.setItem(HISTORY_KEY, JSON.stringify(list.slice(0, HISTORY_MAX)));+ } catch {+ // Quota or private-mode — the rail just won't persist; not fatal.+ }+}++function pushHistory(entry) {+ const list = loadHistory().filter((it) => it.glbUrl !== entry.glbUrl);+ list.unshift(entry);+ const trimmed = list.slice(0, HISTORY_MAX);+ saveHistory(trimmed);+ renderHistory(trimmed);+}++function renderHistory(list = loadHistory()) {+ if (!els.history || !els.historyTrack) return;+ els.history.hidden = list.length === 0;+ els.historyTrack.innerHTML = '';+ for (const item of list) {+ const btn = document.createElement('button');+ btn.type = 'button';+ btn.className = 'hf-thumb';+ btn.setAttribute('role', 'listitem');+ btn.dataset.glb = item.glbUrl;+ const label = item.prompt || '3D model';+ btn.title = label;+ btn.setAttribute('aria-label', `Bring back: ${label}`);+ btn.setAttribute('aria-current', item.glbUrl === currentGlbUrl ? 'true' : 'false');+ if (item.thumb) {+ btn.style.backgroundImage = `url("${item.thumb}")`;+ } else {+ const fb = document.createElement('span');+ fb.className = 'hf-thumb-fallback';+ fb.textContent = (label.trim()[0] || '?').toUpperCase();+ fb.setAttribute('aria-hidden', 'true');+ btn.appendChild(fb);+ }+ btn.addEventListener('click', () => {+ if (busy) return;+ lastPrompt = item.prompt || lastPrompt;+ showResult(item.glbUrl, item.prompt || '', { fromHistory: true });+ });+ els.historyTrack.appendChild(btn);+ }+}++function markActiveThumb() {+ if (!els.historyTrack) return;+ for (const btn of els.historyTrack.querySelectorAll('.hf-thumb')) {+ btn.setAttribute('aria-current', btn.dataset.glb === currentGlbUrl ? 'true' : 'false');+ }+}++// Grab a real frame off the live viewer's canvas, square-crop and shrink it to+// a tiny WebP so a session's worth of thumbnails fits comfortably in storage.+async function captureThumb(viewer) {+ try {+ if (viewer.updateComplete) await viewer.updateComplete;+ await new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(r)));+ const full = viewer.toDataURL('image/webp', 0.85);+ return await downscaleDataUrl(full, THUMB_SIZE);+ } catch {+ return null; // tainted canvas / unsupported — fall back to a letter tile.+ }+}++function downscaleDataUrl(src, size) {+ return new Promise((resolve) => {+ const img = new Image();+ img.onload = () => {+ try {+ const canvas = document.createElement('canvas');+ canvas.width = canvas.height = size;+ const ctx = canvas.getContext('2d');+ const side = Math.min(img.width, img.height);+ const sx = (img.width - side) / 2;+ const sy = (img.height - side) / 2;+ ctx.drawImage(img, sx, sy, side, side, 0, 0, size, size);+ resolve(canvas.toDataURL('image/webp', 0.7));+ } catch {+ resolve(null);+ }+ };+ img.onerror = () => resolve(null);+ img.src = src;+ });+}++// ── Pipeline ───────────────────────────────────────────────────────+async function startJob(prompt) {const res = await fetch('/api/forge', {method: 'POST',@@ -181,26 +320,75 @@ async function pollUntilDone(jobId, seq) {throw new Error('Generation timed out — try a simpler, single-subject prompt.');}-function showResult(glbUrl, prompt) {+function sceneLinkFor(glbUrl, prompt) {+ const q = new URLSearchParams({ model: glbUrl });+ if (prompt) q.set('name', prompt.slice(0, 80));+ return `/scene?${q.toString()}`;+}++function downloadName(prompt) {+ return (+ `${(prompt || 'forge')+ .replace(/[^a-z0-9]+/gi, '-')+ .slice(0, 48)+ .replace(/^-|-$/g, '')}` || 'forge'+ );+}++function showResult(glbUrl, prompt, { fromHistory = false } = {}) {stopElapsed();+ currentGlbUrl = glbUrl;const viewer = document.createElement('model-viewer');viewer.setAttribute('src', glbUrl);- viewer.setAttribute('alt', `3D model: ${prompt}`);+ viewer.setAttribute('alt', prompt ? `3D model: ${prompt}` : '3D model');viewer.setAttribute('camera-controls', '');viewer.setAttribute('auto-rotate', '');viewer.setAttribute('auto-rotate-delay', '0');viewer.setAttribute('rotation-per-second', '18deg');- viewer.setAttribute('shadow-intensity', '1');viewer.setAttribute('interaction-prompt', 'none');+ viewer.setAttribute('shadow-intensity', '1');+ viewer.setAttribute('exposure', '1.05');+ viewer.setAttribute('environment-image', 'neutral');+ viewer.setAttribute('touch-action', 'pan-y');+ // AR where the device supports it — a real, free win on phones.+ viewer.setAttribute('ar', '');+ viewer.setAttribute('ar-modes', 'webxr scene-viewer quick-look');els.viewerSlot.innerHTML = '';els.viewerSlot.appendChild(viewer);- els.resultMeta.textContent = prompt;- els.download.href = glbUrl;- els.download.setAttribute(- 'download',- `${prompt.replace(/[^a-z0-9]+/gi, '-').slice(0, 48).replace(/^-|-$/g, '') || 'forge'}.glb`,- );+ currentViewer = viewer;++ // Reset the rotate toggle to its default-on state for the new model.+ if (els.spin) {+ els.spin.setAttribute('aria-pressed', 'true');+ els.spin.title = 'Pause auto-rotate';+ }++ els.resultMeta.textContent = prompt || 'Untitled model';+ els.resultMeta.title = prompt || '';+ if (els.download) {+ els.download.href = glbUrl;+ els.download.setAttribute('download', `${downloadName(prompt)}.glb`);+ }+ if (els.scene) els.scene.href = sceneLinkFor(glbUrl, prompt);+showState('result');+ markActiveThumb();++ // Capture a frame off this render for the history rail (fresh forges only —+ // a reload from history already has its thumbnail).+ if (!fromHistory) {+ viewer.addEventListener(+ 'load',+ () => {+ captureThumb(viewer).then((thumb) => {+ pushHistory({ glbUrl, prompt, thumb, ts: Date.now() });+ markActiveThumb();+ });+ },+ { once: true },+ );+ }+// Materialize: blur-in on the viewer + a one-shot scanline sweep.if (!REDUCED_MOTION) {els.viewerSlot.classList.remove('is-in');@@ -209,13 +397,27 @@ function showResult(glbUrl, prompt) {els.viewerSlot.classList.add('is-in');els.scan.classList.add('is-scan');}++ // Hand keyboard focus to the action bar so the model is operable without a+ // mouse the instant it lands.+ if (els.resultRegion) {+ try {+ els.resultRegion.focus({ preventScroll: true });+ } catch {+ els.resultRegion.focus();+ }+ }+// Same signal the full page emits — the discovery layer turns it into a- // "what's next?" card (embed it, drop it in a world, …).- document.dispatchEvent(- new CustomEvent('tws:feature-done', {- detail: { feature: 'forge', model: { glbUrl, label: prompt } },- }),- );+ // "what's next?" card (embed it, drop it in a world, …). Only on fresh+ // forges, so reloading a thumbnail doesn't re-trigger the cards.+ if (!fromHistory) {+ document.dispatchEvent(+ new CustomEvent('tws:feature-done', {+ detail: { feature: 'forge', model: { glbUrl, label: prompt } },+ }),+ );+ }}async function run(prompt) {@@ -274,6 +476,9 @@ function reset() {pollAbort = true;stopElapsed();setBusy(false);+ currentGlbUrl = '';+ currentViewer = null;+ markActiveThumb();showState('idle');els.prompt.focus();}@@ -355,6 +560,40 @@ function autoGrow() {els.prompt.style.height = `${els.prompt.scrollHeight}px`;}+async function copyShareLink() {+ if (!currentGlbUrl) return;+ const url = new URL(sceneLinkFor(currentGlbUrl, lastPrompt), location.origin).href;+ try {+ await navigator.clipboard.writeText(url);+ showToast('Share link copied');+ } catch {+ // Clipboard blocked (permissions / insecure context) — fall back to a+ // transient selectable field the user can copy manually.+ const input = document.createElement('input');+ input.value = url;+ input.style.cssText = 'position:fixed;top:-1000px;left:0;opacity:0;';+ document.body.appendChild(input);+ input.select();+ let ok = false;+ try {+ ok = document.execCommand('copy');+ } catch {+ ok = false;+ }+ document.body.removeChild(input);+ showToast(ok ? 'Share link copied' : 'Press ⌘/Ctrl-C to copy');+ }+}++function toggleAutoRotate() {+ if (!currentViewer || !els.spin) return;+ const on = currentViewer.hasAttribute('auto-rotate');+ if (on) currentViewer.removeAttribute('auto-rotate');+ else currentViewer.setAttribute('auto-rotate', '');+ els.spin.setAttribute('aria-pressed', String(!on));+ els.spin.title = on ? 'Resume auto-rotate' : 'Pause auto-rotate';+}+function boot() {els.form.addEventListener('submit', (e) => {e.preventDefault();@@ -401,6 +640,14 @@ function boot() {else reset();});+ if (els.spin) els.spin.addEventListener('click', toggleAutoRotate);+ if (els.share) els.share.addEventListener('click', copyShareLink);+ if (els.vary)+ els.vary.addEventListener('click', () => {+ if (lastPrompt && !busy) run(lastPrompt);+ });++ renderHistory();startTypewriter();startParallax();}diff --git a/tests/api/forge-health.test.js b/tests/api/forge-health.test.jsindex 62f34638f..4467725d8 100644--- a/tests/api/forge-health.test.js+++ b/tests/api/forge-health.test.js@@ -16,6 +16,13 @@ const ENV_VARS = ['GCP_TRIPOSG_URL','GCP_RECONSTRUCTION_URL','GCP_RECONSTRUCTION_KEY',+ 'UPSTASH_REDIS_REST_URL',+ 'UPSTASH_REDIS_REST_TOKEN',+ 'three_KV_REST_API_URL',+ 'three_KV_REST_API_TOKEN',+ 'KV_REST_API_URL',+ 'KV_REST_API_TOKEN',+ 'VERCEL_ENV',];const savedEnv = {};let savedFetch;@@ -137,6 +144,63 @@ describe('forge-health — per-backend verdicts', () => {});});+describe('forge-health — rate-limiter store', () => {+ // The June 2026 outage: Upstash over quota → critical limiters failed+ // closed → every paid-lane generation 429'd while all backends read ok.+ // These tests pin the limiter store to the health report so that failure+ // mode can never be invisible again.+ it('reports ok with the in-memory fallback outside production', async () => {+ mockUpstreams([]);+ const health = await probeForgeHealth();+ expect(health.limiter.status).toBe('ok');+ expect(health.limiter.message).toMatch(/in-memory/i);+ });++ it('reports down (and degrades overall) when unconfigured in production', async () => {+ process.env.VERCEL_ENV = 'production';+ mockUpstreams([]);+ const health = await probeForgeHealth();+ expect(health.limiter.status).toBe('down');+ expect(health.limiter.message).toMatch(/fail closed/i);+ expect(health.status).toBe('degraded');+ });++ it('passes when the store answers PING', async () => {+ process.env.UPSTASH_REDIS_REST_URL = 'https://probe.upstash.io';+ process.env.UPSTASH_REDIS_REST_TOKEN = 'token';+ global.fetch = vi.fn(async () => new Response('{"result":"PONG"}', { status: 200 }));+ const health = await probeForgeHealth();+ expect(health.limiter.status).toBe('ok');+ });++ it('reports down when the store rejects commands (over quota)', async () => {+ process.env.UPSTASH_REDIS_REST_URL = 'https://probe.upstash.io';+ process.env.UPSTASH_REDIS_REST_TOKEN = 'token';+ global.fetch = vi.fn(+ async () =>+ new Response('{"error":"ERR max requests limit exceeded. Limit: 500000, Usage: 500000"}', {+ status: 429,+ }),+ );+ const health = await probeForgeHealth();+ expect(health.limiter.status).toBe('down');+ expect(health.limiter.message).toMatch(/max requests limit/i);+ expect(health.status).toBe('degraded');+ });++ it('resolves the store through the three_KV fallback names', async () => {+ process.env.three_KV_REST_API_URL = 'https://fallback.upstash.io';+ process.env.three_KV_REST_API_TOKEN = 'token';+ global.fetch = vi.fn(async () => new Response('{"result":"PONG"}', { status: 200 }));+ const health = await probeForgeHealth();+ expect(health.limiter.status).toBe('ok');+ expect(global.fetch).toHaveBeenCalledWith(+ 'https://fallback.upstash.io',+ expect.objectContaining({ method: 'POST' }),+ );+ });+});+describe('forge-health — caching', () => {it('serves the cached payload within the TTL and re-probes on force', async () => {process.env.REPLICATE_API_TOKEN = 'r8_test';diff --git a/tests/api/x402-discovery-parity.test.js b/tests/api/x402-discovery-parity.test.jsindex 4e6f93584..d3be51430 100644--- a/tests/api/x402-discovery-parity.test.js+++ b/tests/api/x402-discovery-parity.test.js@@ -110,6 +110,21 @@ describe('x402 discovery catalog parity', () => {).toEqual([]);});+ it('catalogs both hosted MCP servers with their own identities', async () => {+ // The 3D Studio (text→3D) lived for months as a deployed-but-uncataloged+ // endpoint — x402 facilitators could never index it. Keep both MCP+ // transports in the discovery doc, each under its own service identity.+ const doc = await renderDiscovery();+ const mcp = doc.resources.find((r) => r.path === '/api/mcp');+ const studio = doc.resources.find((r) => r.path === '/api/mcp-3d');+ expect(mcp, '/api/mcp missing from discovery').toBeTruthy();+ expect(studio, '/api/mcp-3d missing from discovery').toBeTruthy();+ expect(studio.serviceName).toBe('three.ws 3D Studio MCP');+ expect(studio.description).toContain('text_to_3d');+ expect(studio.extensions.bazaar.info.input.body.params.name).toBe('text_to_3d');+ expect(studio.accepts.length).toBeGreaterThan(0);+ });+it('every cataloged x402 resource carries a price and at least one accept', async () => {const doc = await renderDiscovery();const x402Resources = doc.resources.filter((r) => r.path?.startsWith('/api/x402/'));diff --git a/vercel.json b/vercel.jsonindex 706515e83..9bd3ed583 100644--- a/vercel.json+++ b/vercel.json@@ -39,6 +39,10 @@"includeFiles": "{examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**,sdk/src/sas-config.json}","maxDuration": 300},+ "api/cron/forge-smoke.js": {+ "includeFiles": "{examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**,sdk/src/sas-config.json}",+ "maxDuration": 300+ },"api/agents/gmgn.js": {"includeFiles": "{examples/skills/**,data/pages.json,data/archives/**,data/rss/**,data/_generated/**,sdk/src/sas-config.json}","maxDuration": 120@@ -3018,6 +3022,10 @@"path": "/api/cron/uptime-check","schedule": "*/5 * * * *"},+ {+ "path": "/api/cron/forge-smoke",+ "schedule": "30 9 * * *"+ },{"path": "/api/cron/cleanup-csrf-tokens","schedule": "17 * * * *"