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 + mesh-forge improvements, rig-mesh MCP tool
nirholas84e8e72fd157
diff --git a/api/forge.js b/api/forge.jsindex a4eeae007..048f244a8 100644--- a/api/forge.js+++ b/api/forge.js@@ -1,8 +1,10 @@/**- * Forge — browser-facing text → 3D model generator.+ * Forge — browser-facing text/image → 3D model generator + auto-rigger.*- * POST /api/forge { prompt, aspect_ratio? } → start a job- * GET /api/forge?job=<id> → poll a job+ * POST /api/forge { prompt, aspect_ratio? } → text→3D job+ * POST /api/forge { image_url, prompt? } → image→3D job+ * POST /api/forge?action=rig { glb_url } → auto-rig a GLB+ * GET /api/forge?job=<id> → poll any job** This is the public, auth-free twin of the 3D Studio MCP server* (api/mcp-3d.js): it drives the exact same real pipeline — a flux-schnell@@ -30,6 +32,11 @@ import {const VALID_ASPECT = new Set(['1:1', '4:3', '3:4', '16:9', '9:16']);+// Guard for caller-supplied reference image / source GLB URLs. http(s) only,+// bounded length — we forward these to the reconstruction/rig provider, so we+// never accept data: URLs or unbounded strings.+const HTTP_URL_RE = /^https?:\/\/[^\s]+$/i;+// A Replicate prediction id is a lowercase base32-ish token. Constrain the// poll parameter to that shape so we never forward arbitrary strings upstream.const JOB_ID_RE = /^[a-z0-9]{16,64}$/;@@ -62,11 +69,34 @@ async function startJob(req, res) {}const body = await readJson(req, 8_000).catch(() => null);++ // Two reconstruction modes share this path:+ // • image→3D — a caller supplies image_url; we reconstruct it directly and+ // skip the text-to-image stage. An optional prompt may still guide the+ // model where it accepts one.+ // • text→3D — no image_url; we synthesize the reference image from the+ // prompt with FLUX first, then reconstruct.+ const imageUrl = typeof body?.image_url === 'string' ? body.image_url.trim() : '';+ const isImageMode = imageUrl.length > 0;const prompt = typeof body?.prompt === 'string' ? body.prompt.trim() : '';- if (prompt.length < 3 || prompt.length > 1000) {++ if (isImageMode) {+ if (!HTTP_URL_RE.test(imageUrl) || imageUrl.length > 2048) {+ return json(res, 400, {+ error: 'invalid_image_url',+ message: 'image_url must be an http(s) URL under 2048 characters.',+ });+ }+ if (prompt.length > 1000) {+ return json(res, 400, {+ error: 'invalid_prompt',+ message: 'Optional guidance prompt must be 1000 characters or fewer.',+ });+ }+ } else if (prompt.length < 3 || prompt.length > 1000) {return json(res, 400, {error: 'invalid_prompt',- message: 'Describe one subject in 3–1000 characters.',+ message: 'Describe one subject in 3–1000 characters, or pass image_url for image-to-3D.',});}const aspect = VALID_ASPECT.has(body?.aspect_ratio) ? body.aspect_ratio : '1:1';@@ -79,10 +109,23 @@ async function startJob(req, res) {}try {- const { imageUrl, model } = await textToImage(prompt, { aspectRatio: aspect });+ // Resolve the reference image: supplied directly (image→3D) or synthesized+ // from the prompt (text→3D).+ let referenceImageUrl;+ let textToImageModel;+ if (isImageMode) {+ referenceImageUrl = imageUrl;+ textToImageModel = null;+ } else {+ const synthesized = await textToImage(prompt, { aspectRatio: aspect });+ referenceImageUrl = synthesized.imageUrl;+ textToImageModel = synthesized.model;+ }+const job = await provider.submit({mode: 'reconstruct',- params: { image: imageUrl, prompt },+ sourceUrl: referenceImageUrl,+ params: { images: [referenceImageUrl], prompt: prompt || undefined },});// Record the generation the moment it starts so the prompt + reference@@ -91,20 +134,21 @@ async function startJob(req, res) {const creationId = await createCreation({clientKey: clientKeyFrom(req),ipHash: hashIp(ip),- prompt,+ prompt: prompt || (isImageMode ? 'image-to-3d' : ''),aspect,- previewImageUrl: imageUrl,+ previewImageUrl: referenceImageUrl,replicateJobId: job.extJobId,- textToImageModel: model,+ textToImageModel,});return json(res, 200, {job_id: job.extJobId,creation_id: creationId,status: 'queued',- prompt,- preview_image_url: imageUrl,- text_to_image_model: model,+ mode: isImageMode ? 'image_to_3d' : 'text_to_3d',+ prompt: prompt || null,+ preview_image_url: referenceImageUrl,+ text_to_image_model: textToImageModel,eta_seconds: typeof job.eta === 'number' ? job.eta : null,});} catch (err) {@@ -126,6 +170,84 @@ async function startJob(req, res) {}}+// Auto-rig an existing GLB mesh: skeleton + skin weights via the provider's+// `rerig` mode (VAST-AI UniRig by default). Takes a GLB URL, returns a job id+// that polls through the same GET ?job=<id> path — provider.status() is+// mode-agnostic, so the rigged GLB surfaces exactly like a reconstruction.+async function startRigJob(req, res) {+ const ip = clientIp(req);+ const rl = await limits.mcp3dGenerate(ip);+ if (!rl.success) {+ return json(res, 429, {+ error: 'rate_limited',+ message: 'Rigging limit reached. Try again shortly.',+ retry_after: Math.ceil((rl.reset - Date.now()) / 1000),+ });+ }++ const body = await readJson(req, 8_000).catch(() => null);+ const glbUrl = typeof body?.glb_url === 'string' ? body.glb_url.trim() : '';+ if (!HTTP_URL_RE.test(glbUrl) || glbUrl.length > 2048) {+ return json(res, 400, {+ error: 'invalid_glb_url',+ message: 'glb_url must be an http(s) URL to a GLB mesh, under 2048 characters.',+ });+ }++ let provider;+ try {+ provider = createRegenProvider();+ } catch {+ return unconfigured(res);+ }++ // Rigging stays dormant until a rerig model is configured — surface a clean+ // 501 rather than a generic provider error so callers can branch on it.+ if (!provider.supportsMode('rerig')) {+ return json(res, 501, {+ error: 'rig_unconfigured',+ message:+ 'Auto-rigging is not configured on this deployment (REPLICATE_RERIG_MODEL is not set).',+ });+ }++ try {+ const job = await provider.submit({ mode: 'rerig', sourceUrl: glbUrl, params: {} });+ const creationId = await createCreation({+ clientKey: clientKeyFrom(req),+ ipHash: hashIp(ip),+ prompt: 'auto-rig',+ aspect: null,+ previewImageUrl: null,+ replicateJobId: job.extJobId,+ textToImageModel: null,+ });+ return json(res, 200, {+ job_id: job.extJobId,+ creation_id: creationId,+ status: 'queued',+ mode: 'rig',+ source_glb_url: glbUrl,+ eta_seconds: typeof job.eta === 'number' ? job.eta : null,+ });+ } catch (err) {+ if (err?.code === 'mode_unconfigured') {+ return json(res, 501, { error: 'rig_unconfigured', message: err.message });+ }+ if (err?.code === 'rate_limited' || err?.providerStatus === 429) {+ return json(res, 429, {+ error: 'rate_limited',+ message: 'The rigger is busy right now. Try again in a few seconds.',+ retry_after: 10,+ });+ }+ return json(res, 502, {+ error: 'rig_failed',+ message: err?.message || 'The rigger could not start this job.',+ });+ }+}+async function pollJob(req, res, jobId) {if (!JOB_ID_RE.test(jobId)) {return json(res, 400, { error: 'invalid_job', message: 'Malformed job id.' });@@ -180,9 +302,17 @@ export default wrap(async (req, res) => {if (cors(req, res, { methods: 'GET,POST,OPTIONS' })) return;if (!method(req, res, ['GET', 'POST'])) return;- if (req.method === 'POST') return startJob(req, res);-const url = new URL(req.url, 'http://localhost');++ if (req.method === 'POST') {+ // ?action=rig auto-rigs an existing GLB; the default POST reconstructs a+ // mesh from a prompt (text→3D) or a reference image (image→3D).+ if ((url.searchParams.get('action') || '').trim() === 'rig') {+ return startRigJob(req, res);+ }+ return startJob(req, res);+ }+const jobId = (url.searchParams.get('job') || '').trim();if (!jobId) {return json(res, 400, { error: 'missing_job', message: 'Pass ?job=<id> to poll a job.' });diff --git a/mcp-server/src/index.js b/mcp-server/src/index.jsindex 5130450f9..45a6c75d4 100755--- a/mcp-server/src/index.js+++ b/mcp-server/src/index.js@@ -31,6 +31,7 @@ import { buildAgentReputationTool } from './tools/agent-reputation.js';import { buildVanityGrinderTool } from './tools/vanity-grinder.js';import { buildTextToAvatarTool } from './tools/text-to-avatar.js';import { buildMeshForgeTool } from './tools/mesh-forge.js';+import { buildRigMeshTool } from './tools/rig-mesh.js';import { buildSentimentPulseTool } from './tools/sentiment-pulse.js';import { buildEnsSnsResolveTool } from './tools/ens-sns-resolve.js';import { buildAgentDelegateActionTool } from './tools/agent-delegate-action.js';@@ -42,7 +43,8 @@ const SERVER_INSTRUCTIONS ='Paid x402 MCP tools from three.ws. Each tool quotes its USDC price in its description. ' +'Tool calls without an x402 payment payload in _meta return a PaymentRequired structuredContent ' +'(v2 MCP transport spec). Tools cover: 3D avatar generation (text_to_avatar), ' +- 'text-to-3D mesh generation via a Granite-directed model chain (mesh_forge), ' ++ 'text/image-to-3D mesh generation via a Granite-directed model chain (mesh_forge), ' ++ 'auto-rigging a GLB into an animation-ready model (rig_mesh), ' +'ENS + SNS name resolution ' +'(ens_sns_resolve), agent-to-agent delegation (agent_delegate_action), token sentiment pulse ' +'(sentiment_pulse), pose generation (get_pose_seed), Solana token snapshots (pump_snapshot), ' +@@ -57,6 +59,7 @@ const SERVER_INSTRUCTIONS =const TOOL_BUILDERS = [buildTextToAvatarTool,buildMeshForgeTool,+ buildRigMeshTool,buildEnsSnsResolveTool,buildAgentDelegateActionTool,buildSentimentPulseTool,diff --git a/mcp-server/src/tools/mesh-forge.js b/mcp-server/src/tools/mesh-forge.jsindex 5e94895f7..2528fc598 100644--- a/mcp-server/src/tools/mesh-forge.js+++ b/mcp-server/src/tools/mesh-forge.js@@ -8,20 +8,22 @@// holds the Replicate / watsonx keys). The x402 USDC payment is what gates the// call.//-// The pipeline is a chain of specialist models, each doing one job:-// 1. Prompt director (IBM Granite via /api/chat, provider=watsonx) — rewrites-// the caller's rough idea into an optimized 3D-generation spec (subject,-// style, materials, single-subject framing). Fail-soft: if the director is-// unreachable or disabled, the original prompt is forwarded unchanged and-// `directed:false` is reported — never a fabricated result.-// 2. Reference synthesis + reconstruction (/api/forge) — FLUX renders a clean-// reference image, then Microsoft TRELLIS / Tencent Hunyuan3D reconstructs-// a textured GLB. This tool submits the job and polls to a terminal state.-// 3. Delivery — returns the durable GLB URL and a three.ws viewer link.+// Two modes:+// • text→3D — a chain of specialist models, each doing one job:+// 1. Prompt director (IBM Granite via /api/chat, provider=watsonx) —+// rewrites the caller's rough idea into an optimized 3D-generation spec+// (subject, style, materials, single-subject framing). Fail-soft: if+// the director is unreachable or disabled, the original prompt is+// forwarded unchanged and `directed:false` is reported — never faked.+// 2. Reference synthesis + reconstruction (/api/forge) — FLUX renders a+// clean reference image, then TRELLIS / Hunyuan3D reconstruct a+// textured GLB.+// • image→3D — a caller-supplied image_url is reconstructed directly+// (/api/forge with image_url); the prompt-director stage is skipped.//-// Image→3D and auto-rigging are deliberately NOT exposed yet: no public prod-// endpoint reconstructs an arbitrary caller-supplied image into a riggable mesh-// today, and this tool never advertises an input it can't honor.+// Either mode returns a textured GLB URL and a three.ws viewer link. Rigging is+// a separate composable step — feed the returned glbUrl to the `rig_mesh` tool+// for a skeleton + skin weights (animation-ready) GLB.//// Environment (all optional — sensible prod defaults):// MESH_FORGE_API_BASE — three.ws origin. Default https://three.ws@@ -37,7 +39,7 @@ import { jsonSchemaFromZod } from './_shared.js';const TOOL_NAME = 'mesh_forge';const TOOL_DESCRIPTION =- 'Generate a textured 3D GLB model from a text prompt through a chain of specialist models: an IBM Granite "prompt director" rewrites the prompt into an optimized 3D spec, FLUX renders a reference image, and Microsoft TRELLIS / Tencent Hunyuan3D reconstruct the mesh. Returns the GLB URL, a three.ws viewer link, the directed prompt, and timing. Paid: $0.25 USDC.';+ 'Generate a textured 3D GLB model from a text prompt OR a reference image. In text mode, a chain of specialist models runs: an IBM Granite "prompt director" rewrites the prompt into an optimized 3D spec, FLUX renders a reference image, then Microsoft TRELLIS / Tencent Hunyuan3D reconstruct the mesh. In image mode, a supplied image_url is reconstructed directly. Returns the GLB URL, a three.ws viewer link, the directed prompt (text mode), and timing. Feed the GLB to rig_mesh for a rigged, animation-ready model. Paid: $0.25 USDC.';const VALID_ASPECT = new Set(['1:1', '4:3', '3:4', '16:9', '9:16']);@@ -118,12 +120,15 @@ async function directPrompt(rawPrompt) {return refined.length >= 3 && refined.length <= 1000 ? refined : null;}-async function startForge(prompt, aspect) {+async function startForge({ prompt, aspect, imageUrl }) {const base = apiBase();+ const payload = imageUrl+ ? { image_url: imageUrl, prompt: prompt || undefined, aspect_ratio: aspect }+ : { prompt, aspect_ratio: aspect };const res = await fetch(`${base}/api/forge`, {method: 'POST',headers: { 'content-type': 'application/json' },- body: JSON.stringify({ prompt, aspect_ratio: aspect }),+ body: JSON.stringify(payload),signal: AbortSignal.timeout(30_000),});const data = await res.json().catch(() => ({}));@@ -189,14 +194,20 @@ const inputZodShape = {.string().min(3).max(1000)- .describe('Natural-language description of the single object to model, e.g. "a worn leather armchair".'),+ .describe('Text→3D: natural-language description of the single object to model, e.g. "a worn leather armchair". Optional when image_url is provided (then used only as guidance).')+ .optional(),+ image_url: z+ .string()+ .url()+ .describe('Image→3D: an http(s) URL to a reference image to reconstruct directly. When set, the prompt-director and text-to-image stages are skipped.')+ .optional(),aspect_ratio: z.enum(['1:1', '4:3', '3:4', '16:9', '9:16'])- .describe('Reference image aspect ratio. Default 1:1 (best for isolated objects).')+ .describe('Reference image aspect ratio (text mode). Default 1:1 (best for isolated objects).').optional(),direct: z.boolean()- .describe('Run the IBM Granite prompt-director stage to optimize the prompt before generation. Default true.')+ .describe('Run the IBM Granite prompt-director stage to optimize the prompt before generation (text mode only). Default true.').optional(),};@@ -224,20 +235,34 @@ export async function buildMeshForgeTool() {durationMs: 96000,},},- async ({ prompt, aspect_ratio, direct }) => {+ async ({ prompt, image_url, aspect_ratio, direct }) => {+ const trimmedPrompt = typeof prompt === 'string' ? prompt.trim() : '';+ const imageMode = typeof image_url === 'string' && image_url.trim().length > 0;+ if (!imageMode && trimmedPrompt.length < 3) {+ return toolError(+ 'invalid_input',+ 'Provide a prompt (3+ chars) for text→3D, or an image_url for image→3D.',+ );+ }const aspect = VALID_ASPECT.has(aspect_ratio) ? aspect_ratio : '1:1';const started = Date.now();- // Stage 1 — Granite prompt director (fail-soft, opt-out).- const runDirector = direct !== false && env('MESH_FORGE_DIRECTOR', '1') !== '0';+ // Stage 1 — Granite prompt director (text mode only; fail-soft, opt-out).+ const runDirector =+ !imageMode && trimmedPrompt && direct !== false && env('MESH_FORGE_DIRECTOR', '1') !== '0';let directedPrompt = null;- if (runDirector) directedPrompt = await directPrompt(prompt);- const effectivePrompt = directedPrompt || prompt;+ if (runDirector) directedPrompt = await directPrompt(trimmedPrompt);+ const effectivePrompt = directedPrompt || trimmedPrompt;- // Stage 2 — submit reference synthesis + reconstruction.+ // Stage 2 — submit reference synthesis + reconstruction (or direct+ // image reconstruction when an image_url was supplied).let job;try {- job = await startForge(effectivePrompt, aspect);+ job = await startForge({+ prompt: effectivePrompt || undefined,+ aspect,+ imageUrl: imageMode ? image_url.trim() : undefined,+ });} catch (err) {return toolError(err.code || 'provider_error', err.message, {...(err.retryAfter ? { retryAfter: err.retryAfter } : {}),@@ -276,9 +301,11 @@ export async function buildMeshForgeTool() {return {ok: true,+ mode: imageMode ? 'image_to_3d' : 'text_to_3d',glbUrl,preview,- prompt,+ prompt: trimmedPrompt || null,+ imageUrl: imageMode ? image_url.trim() : null,directedPrompt: directedPrompt || null,directed: Boolean(directedPrompt),jobId: job.job_id,diff --git a/mcp-server/src/tools/rig-mesh.js b/mcp-server/src/tools/rig-mesh.jsnew file mode 100644index 000000000..9cd027367--- /dev/null+++ b/mcp-server/src/tools/rig-mesh.js@@ -0,0 +1,199 @@+// `rig_mesh` — paid MCP tool: static GLB → rigged, animation-ready GLB.+//+// Pricing: $0.20 USDC, settled `exact` on Solana.+//+// Takes a GLB mesh URL and returns a rigged GLB — a humanoid skeleton plus+// per-vertex skin weights — produced by the three.ws auto-rig pipeline+// (/api/forge?action=rig, VAST-AI UniRig by default). Like mesh_forge, this is+// a thin x402-gated client over the prod pipeline: it holds no generation+// credentials; the USDC payment gates the call and all GPU work runs on+// three.ws prod.+//+// Composes with mesh_forge: forge a mesh (text or image → GLB), then feed the+// returned glbUrl here to get an animation-ready model that loads straight into+// the three.ws pose studio.+//+// Environment (all optional — sensible prod defaults):+// MESH_FORGE_API_BASE — three.ws origin. Default https://three.ws+// RIG_MESH_TIMEOUT_MS — overall rig poll budget. Default 180000.+// RIG_MESH_POLL_MS — poll interval. Default 3000.++import { z } from 'zod';++import { paid, toolError } from '../payments.js';+import { jsonSchemaFromZod } from './_shared.js';++const TOOL_NAME = 'rig_mesh';+const TOOL_DESCRIPTION =+ 'Auto-rig a static 3D GLB mesh into an animation-ready model: adds a humanoid skeleton and per-vertex skin weights via the three.ws rig pipeline (VAST-AI UniRig by default). Takes a GLB URL, returns the rigged GLB URL and a three.ws pose-studio link. Pairs with mesh_forge — forge a mesh, then rig it. Paid: $0.20 USDC.';++function env(k, def) {+ const v = process.env[k];+ return v && String(v).trim() ? String(v).trim() : def;+}++function apiBase() {+ return env('MESH_FORGE_API_BASE', 'https://three.ws').replace(/\/$/, '');+}++async function startRig(glbUrl) {+ const base = apiBase();+ const res = await fetch(`${base}/api/forge?action=rig`, {+ method: 'POST',+ headers: { 'content-type': 'application/json' },+ body: JSON.stringify({ glb_url: glbUrl }),+ signal: AbortSignal.timeout(30_000),+ });+ const data = await res.json().catch(() => ({}));+ if (res.status === 503) {+ const e = new Error(data?.message || 'rigging is not configured on the three.ws deployment');+ e.code = 'not_configured';+ throw e;+ }+ if (res.status === 501) {+ const e = new Error(data?.message || 'auto-rigging is not enabled on the three.ws deployment');+ e.code = 'not_configured';+ throw e;+ }+ if (res.status === 429) {+ const e = new Error(data?.message || 'the rigger is busy; try again shortly');+ e.code = 'rate_limited';+ e.retryAfter = data?.retry_after;+ throw e;+ }+ if (!res.ok || !data?.job_id) {+ const e = new Error(data?.message || `rig start returned ${res.status}`);+ e.code = 'provider_error';+ throw e;+ }+ return data; // { job_id, creation_id, status, mode:'rig', source_glb_url }+}++async function pollRig(jobId, { timeoutMs, intervalMs }) {+ const base = apiBase();+ const deadline = Date.now() + timeoutMs;+ let last = null;+ while (Date.now() < deadline) {+ let res;+ try {+ res = await fetch(`${base}/api/forge?job=${encodeURIComponent(jobId)}`, {+ headers: { accept: 'application/json' },+ signal: AbortSignal.timeout(Math.max(intervalMs * 3, 15_000)),+ });+ } catch (err) {+ if (err?.name === 'AbortError' || err?.name === 'TimeoutError') {+ await new Promise((r) => setTimeout(r, intervalMs));+ continue;+ }+ const e = new Error(`rig poll failed: ${err?.message || err}`);+ e.code = 'provider_error';+ throw e;+ }+ const data = await res.json().catch(() => ({}));+ if (!res.ok) {+ const e = new Error(data?.message || `rig poll returned ${res.status}`);+ e.code = 'provider_error';+ throw e;+ }+ last = data;+ if (data.status === 'done' && data.glb_url) return data;+ if (data.status === 'failed') {+ const e = new Error(data.error || 'rigging failed');+ e.code = 'rig_failed';+ throw e;+ }+ await new Promise((r) => setTimeout(r, intervalMs));+ }+ return { ...(last || {}), _timedOut: true };+}++const inputZodShape = {+ glb_url: z+ .string()+ .url()+ .describe('http(s) URL to the static GLB mesh to rig (e.g. the glbUrl returned by mesh_forge).'),+};++const inputJsonSchema = jsonSchemaFromZod(inputZodShape);++export async function buildRigMeshTool() {+ const handler = await paid(+ {+ toolName: TOOL_NAME,+ description: TOOL_DESCRIPTION,+ scheme: 'exact',+ priceUsd: '$0.20',+ inputSchema: inputJsonSchema,+ example: { glb_url: 'https://three.ws/cdn/creations/abc123/mesh.glb' },+ outputExample: {+ ok: true,+ riggedGlbUrl: 'https://three.ws/cdn/creations/def456/rigged.glb',+ sourceGlbUrl: 'https://three.ws/cdn/creations/abc123/mesh.glb',+ poseStudioUrl: 'https://three.ws/pose?src=https%3A%2F%2Fthree.ws%2F...',+ jobId: 'r9k2m7x4',+ creationId: 'def456',+ durationMs: 48000,+ },+ },+ async ({ glb_url }) => {+ const started = Date.now();++ let job;+ try {+ job = await startRig(glb_url);+ } catch (err) {+ return toolError(err.code || 'provider_error', err.message, {+ ...(err.retryAfter ? { retryAfter: err.retryAfter } : {}),+ });+ }++ const timeoutMs = Number(env('RIG_MESH_TIMEOUT_MS', '180000'));+ const intervalMs = Number(env('RIG_MESH_POLL_MS', '3000'));+ let final;+ try {+ final = await pollRig(job.job_id, { timeoutMs, intervalMs });+ } catch (err) {+ return toolError(err.code || 'provider_error', err.message, {+ jobId: job.job_id,+ creationId: job.creation_id ?? null,+ durationMs: Date.now() - started,+ });+ }++ const durationMs = Date.now() - started;++ if (final._timedOut) {+ return toolError('timeout', `rigging did not finish within ${timeoutMs}ms`, {+ jobId: job.job_id,+ creationId: job.creation_id ?? null,+ status: final.status || 'running',+ resumeUrl: `${apiBase()}/api/forge?job=${job.job_id}`,+ durationMs,+ });+ }++ const riggedGlbUrl = final.glb_url;+ const poseStudioUrl = `${apiBase()}/pose?src=${encodeURIComponent(riggedGlbUrl)}`;++ return {+ ok: true,+ riggedGlbUrl,+ sourceGlbUrl: glb_url,+ poseStudioUrl,+ jobId: job.job_id,+ creationId: final.creation_id ?? job.creation_id ?? null,+ durable: Boolean(final.durable),+ durationMs,+ fetchedAt: new Date().toISOString(),+ };+ },+ );++ return {+ name: TOOL_NAME,+ title: 'Rig 3D mesh ($0.20)',+ description: TOOL_DESCRIPTION,+ inputSchema: inputZodShape,+ handler,+ };+}