Skip to content

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

feat(changelog): implement automatic delivery of changelog updates to holder channels via cron job feat(rpc): add support for paid metered reserve RPC URLs in Solana connection handling docs: update documentation to reflect background generation and completion notifications chore: add changelog push functionality to automate updates to Telegram and X channels

nirholas21da31aacac9
diff --git a/.env.example b/.env.example
index 390411bf7..ad18c977e 100644
--- a/.env.example
+++ b/.env.example
@@ -259,6 +259,10 @@ RPC_URL_84532=https://sepolia.base.org # Base Sepolia (primary dev chain)
RPC_URL_11155111=https://rpc.sepolia.org # Ethereum Sepolia
RPC_URL_421614=https://sepolia-rollup.arbitrum.io/rpc # Arbitrum Sepolia (use Alchemy/Infura in prod)
RPC_URL_11155420=https://sepolia.optimism.io # Optimism Sepolia (use Alchemy/Infura in prod)
+# Optional PAID metered reserve per chain (e.g. a Quicknode credit-funded
+# endpoint). Pattern: RPC_URL_<CHAINID>_LAST_RESORT. Tried AFTER every free
+# public fallback so its monthly quota is only spent when the free chain fails.
+# RPC_URL_8453_LAST_RESORT=
# Per-chain DelegationManager contract address overrides (optional).
# Defaults are from MetaMask Delegation Toolkit v1. Override if you deploy a custom instance.
@@ -1018,12 +1022,17 @@ SOLANA_USDC_MINT=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
# ── Solana / EVM RPC overrides (additional) ──────────────────────────────────
# Primary Solana RPCs (mainnet + devnet). Public endpoints rate-limit hard —
-# set Helius / Triton / QuickNode URLs for production. SOLANA_MAINNET_RPC is
+# set Helius / Triton / Quicknode URLs for production. SOLANA_MAINNET_RPC is
# an older alias still read by a few signing routes; mirror SOLANA_RPC_URL.
SOLANA_MAINNET_RPC=
# Comma-separated list of fallback RPC URLs tried in order on primary failure.
# Used by api/_lib/solana/rpc-fallback.js.
SOLANA_RPC_FALLBACK_URLS=
+# Comma-separated PAID metered endpoints held in reserve (e.g. the Quicknode
+# credit-funded endpoint). Tried dead LAST, after every free/keyless public
+# node, so their monthly quota is only spent when the entire free chain is
+# down or throttled. Mainnet only.
+SOLANA_RPC_LAST_RESORT_URLS=
# Per-chain RPC aliases consulted by /api/permissions/[action] when the
# canonical RPC_URL_<chainId> isn't set. Useful when sharing env across the
diff --git a/api/_lib/changelog-push.js b/api/_lib/changelog-push.js
new file mode 100644
index 000000000..ae1d8fb19
--- /dev/null
+++ b/api/_lib/changelog-push.js
@@ -0,0 +1,290 @@
+// @ts-check
+// Automatic changelog delivery to the holder channels (Telegram + X).
+//
+// This is the server-side twin of scripts/changelog-telegram.mjs and
+// scripts/changelog-x.mjs. Those scripts are manual tools with repo-file
+// state; this module is driven by /api/cron/changelog-push on Cloud
+// Scheduler, reads the changelog feed BAKED INTO THE RUNNING IMAGE
+// (public/changelog.json, regenerated by every deploy build), and keeps its
+// posted-state in Postgres (app_settings). Because the feed comes from the
+// deployed image, an entry can only ever be announced after the deploy that
+// ships it is live; no cron ever announces an undeployed feature.
+//
+// State keys in app_settings:
+// changelog_push_telegram { posted: [ "date:title", … ] }
+// changelog_push_x { posted: […], thread: {anchor,last}|null, recent: [epochMs,…] }
+// changelog_push_lock { until: epochSeconds }, the cross-instance run lock
+//
+// First run seeds each lane's posted-set from the repo state files
+// (data/changelog-*-state.json, also baked into the image) so the cron
+// continues exactly where the manual scripts left off. Entries older than
+// CUTOFF_DAYS are never posted regardless of state, so a reset can never
+// flood the channels with backlog.
+//
+// Message formats are kept byte-identical to the manual scripts.
+
+import { readFileSync } from 'node:fs';
+import { join } from 'node:path';
+import { sql } from './db.js';
+
+const CUTOFF_DAYS = 3;
+const TELEGRAM_LIMIT = 8; // per run; Bot API allows ~20 msg/min per chat
+const TELEGRAM_PACE_MS = 3500;
+const X_LIMIT = 3; // per run
+const X_PACE_MS = 10000;
+const X_DAILY_CAP = 15; // free tier caps user writes at ~17/24h, stay under
+const LOCK_KEY = 'changelog_push_lock';
+const LOCK_TTL_S = 240;
+
+const ANCHOR_TEXT = [
+ 'everything we ship at three.ws lands in this thread. one reply per release, straight from the changelog.',
+ '',
+ 'full log: https://three.ws/changelog',
+].join('\n');
+
+export const entryKey = (e) => `${e.date}:${e.title}`;
+
+function slugify(title, date) {
+ const slug = title.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 80);
+ return date + '-' + slug;
+}
+
+export function loadFeed() {
+ return JSON.parse(readFileSync(join(process.cwd(), 'public', 'changelog.json'), 'utf8'));
+}
+
+function loadRepoState(file) {
+ try {
+ return JSON.parse(readFileSync(join(process.cwd(), 'data', file), 'utf8'));
+ } catch {
+ return null;
+ }
+}
+
+// --- state -----------------------------------------------------------------
+
+async function ensureTable() {
+ await sql`
+ CREATE TABLE IF NOT EXISTS app_settings (
+ key text PRIMARY KEY,
+ value jsonb NOT NULL,
+ updated_at timestamptz NOT NULL DEFAULT now()
+ )
+ `;
+}
+
+async function getState(key) {
+ const [row] = await sql`SELECT value FROM app_settings WHERE key = ${key}`;
+ return row?.value ?? null;
+}
+
+async function setState(key, value) {
+ await sql`
+ INSERT INTO app_settings (key, value) VALUES (${key}, ${JSON.stringify(value)}::jsonb)
+ ON CONFLICT (key) DO UPDATE SET value = excluded.value, updated_at = now()
+ `;
+}
+
+// Cross-instance run lock: claim succeeds only when no unexpired claim exists.
+export async function acquireLock() {
+ await ensureTable();
+ const rows = await sql`
+ INSERT INTO app_settings (key, value)
+ VALUES (${LOCK_KEY}, jsonb_build_object('until', extract(epoch from now()) + ${LOCK_TTL_S}))
+ ON CONFLICT (key) DO UPDATE
+ SET value = excluded.value, updated_at = now()
+ WHERE (app_settings.value->>'until')::numeric < extract(epoch from now())
+ RETURNING key
+ `;
+ return rows.length > 0;
+}
+
+export async function releaseLock() {
+ await setState(LOCK_KEY, { until: 0 });
+}
+
+// --- shared selection ------------------------------------------------------
+
+function cutoffDate() {
+ return new Date(Date.now() - CUTOFF_DAYS * 86400000).toISOString().slice(0, 10);
+}
+
+function pendingEntries(feed, posted, limit, { newestWin = false } = {}) {
+ const cutoff = cutoffDate();
+ const unposted = feed.entries
+ .filter((e) => !posted.has(entryKey(e)) && e.date >= cutoff && e.type !== 'launch')
+ .sort((a, b) => (a.date < b.date ? -1 : a.date > b.date ? 1 : 0));
+ // Telegram keeps the NEWEST entries when over the limit (newestWin); the X
+ // thread takes the OLDEST so the chain stays chronological. Both post in
+ // chronological order.
+ const pending = newestWin ? unposted.slice(-limit) : unposted.slice(0, limit);
+ return { pending, backlog: unposted.length };
+}
+
+const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
+
+// --- Telegram lane ----------------------------------------------------------
+
+const escapeHtml = (s) =>
+ String(s).replace(/[<>&]/g, (c) => ({ '<': '&lt;', '>': '&gt;', '&': '&amp;' })[c]);
+
+function formatTelegramMessage(e) {
+ const detailUrl = `https://three.ws/changelog/${slugify(e.title, e.date)}`;
+ const label = e.type === 'launch' ? 'New on three.ws' : 'Update';
+ const hashtags = (e.type === 'launch' ? ['launch'] : e.tags).map((t) => `#${t}`).join(' ');
+ return [
+ `<b>${escapeHtml(label)} — ${escapeHtml(e.title)}</b>`,
+ '',
+ escapeHtml(e.summary),
+ '',
+ `<a href="${detailUrl}">${escapeHtml(detailUrl.replace('https://', ''))}</a> · ${escapeHtml(e.date)} · ${escapeHtml(hashtags)}`,
+ ].join('\n');
+}
+
+async function sendTelegram(botToken, chatId, text) {
+ const res = await fetch(`https://api.telegram.org/bot${botToken}/sendMessage`, {
+ method: 'POST',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({
+ chat_id: chatId,
+ text,
+ parse_mode: 'HTML',
+ link_preview_options: { is_disabled: false, prefer_small_media: true },
+ }),
+ });
+ const body = await res.json().catch(() => ({}));
+ if (!res.ok || !body.ok) {
+ throw new Error(`Telegram sendMessage failed (${res.status}): ${body.description || 'unknown error'}`);
+ }
+}
+
+export async function pushTelegramLane(feed) {
+ const botToken = process.env.TELEGRAM_BOT_TOKEN;
+ const chatId = process.env.TELEGRAM_CHANGELOG_CHAT_ID;
+ if (!botToken || !chatId) return { skipped: 'not_configured' };
+
+ let state = await getState('changelog_push_telegram');
+ if (!state) {
+ // First run: adopt the manual script's committed state so nothing
+ // already announced is announced twice.
+ state = { posted: loadRepoState('changelog-telegram-state.json')?.posted || [] };
+ await setState('changelog_push_telegram', state);
+ }
+ const posted = new Set(state.posted);
+ const { pending, backlog } = pendingEntries(feed, posted, TELEGRAM_LIMIT, { newestWin: true });
+ if (pending.length === 0) return { posted: 0, backlog };
+
+ let sent = 0;
+ try {
+ for (const e of pending) {
+ await sendTelegram(botToken, chatId, formatTelegramMessage(e));
+ posted.add(entryKey(e));
+ sent++;
+ await setState('changelog_push_telegram', { posted: [...posted] });
+ await sleep(TELEGRAM_PACE_MS);
+ }
+ } catch (err) {
+ // State was persisted after every send, so the next tick resumes cleanly.
+ return { posted: sent, backlog, error: String(err?.message || err) };
+ }
+ return { posted: sent, backlog };
+}
+
+// --- X lane ------------------------------------------------------------------
+
+// X counts every URL as 23 chars (t.co wrapping) and each emoji/astral
+// codepoint as 2. Compose title + summary + link within the 280 budget,
+// trimming the summary on a word boundary when it overflows.
+const URL_WEIGHT = 23;
+const weightedLength = (s) => [...s].reduce((n, ch) => n + (ch.codePointAt(0) > 0xffff ? 2 : 1), 0);
+
+function formatTweet(e) {
+ const detailUrl = `https://three.ws/changelog/${slugify(e.title, e.date)}`;
+ const suffix = `\n\n${detailUrl}`;
+ const suffixWeight = 2 + URL_WEIGHT;
+ const budget = 280 - suffixWeight;
+
+ let body = `${e.title}\n\n${e.summary}`;
+ if (weightedLength(body) > budget) {
+ const titlePart = `${e.title}\n\n`;
+ const summaryBudget = budget - weightedLength(titlePart) - 1; // 1 for the ellipsis
+ let summary = e.summary;
+ while (weightedLength(summary) > summaryBudget && summary.includes(' ')) {
+ summary = summary.slice(0, summary.lastIndexOf(' '));
+ }
+ if (weightedLength(summary) > summaryBudget) summary = summary.slice(0, summaryBudget);
+ body = `${titlePart}${summary.replace(/[\s,.;:]+$/, '')}…`;
+ }
+ return `${body}${suffix}`;
+}
+
+export async function pushXLane(feed) {
+ const creds = {
+ appKey: process.env.X_API_KEY,
+ appSecret: process.env.X_API_SECRET,
+ accessToken: process.env.X_ACCESS_TOKEN,
+ accessSecret: process.env.X_ACCESS_SECRET,
+ };
+ if (!(creds.appKey && creds.appSecret && creds.accessToken && creds.accessSecret)) {
+ return { skipped: 'not_configured' };
+ }
+
+ let state = await getState('changelog_push_x');
+ if (!state) {
+ const repo = loadRepoState('changelog-x-state.json') || {};
+ state = { posted: repo.posted || [], thread: repo.thread || null, recent: [] };
+ await setState('changelog_push_x', state);
+ }
+ const posted = new Set(state.posted);
+ let thread = state.thread || null;
+ // Free-tier write budget: timestamps of posts in the trailing 24h.
+ let recent = (state.recent || []).filter((t) => Date.now() - t < 86400000);
+
+ const saveState = () => setState('changelog_push_x', { posted: [...posted], thread, recent });
+
+ const { pending, backlog } = pendingEntries(feed, posted, X_LIMIT);
+ if (pending.length === 0) {
+ await saveState(); // persist the pruned 24h window
+ return { posted: 0, backlog };
+ }
+ if (recent.length >= X_DAILY_CAP) {
+ return { posted: 0, backlog, skipped: 'daily_cap' };
+ }
+
+ const { TwitterApi } = await import('twitter-api-v2');
+ const client = new TwitterApi(creds);
+ const post = async (text, replyToId) => {
+ const payload = replyToId ? { reply: { in_reply_to_tweet_id: replyToId } } : undefined;
+ const { data } = await client.v2.tweet(text, payload);
+ recent.push(Date.now());
+ return data.id;
+ };
+
+ let sent = 0;
+ let anchorPosted = null;
+ try {
+ if (!thread) {
+ // One-time: the profile keeps a single pinned anchor; every release
+ // chains under it as a reply. The owner pins the anchor once.
+ const id = await post(ANCHOR_TEXT);
+ thread = { anchor: id, last: id };
+ anchorPosted = id;
+ await saveState();
+ await sleep(X_PACE_MS);
+ }
+ for (const e of pending) {
+ if (recent.length >= X_DAILY_CAP) break;
+ const id = await post(formatTweet(e), thread.last);
+ posted.add(entryKey(e));
+ thread = { ...thread, last: id };
+ sent++;
+ // Persist after every post so a crash can't double-post or fork the chain.
+ await saveState();
+ await sleep(X_PACE_MS);
+ }
+ } catch (err) {
+ await saveState().catch(() => {});
+ return { posted: sent, backlog, anchor: anchorPosted, error: String(err?.message || err) };
+ }
+ return { posted: sent, backlog, anchor: anchorPosted };
+}
diff --git a/api/_lib/solana/connection.js b/api/_lib/solana/connection.js
index d0be9e9ba..91dd260a4 100644
--- a/api/_lib/solana/connection.js
+++ b/api/_lib/solana/connection.js
@@ -184,11 +184,27 @@ function extraFallbackUrls() {
.filter(Boolean);
}
+// Operator-supplied LAST-RESORT URLs (comma-separated SOLANA_RPC_LAST_RESORT_URLS).
+// The inverse economics of SOLANA_RPC_FALLBACK_URLS: paid metered endpoints
+// (e.g. the Quicknode credit-funded endpoint) whose quota should be PRESERVED,
+// not load-balanced. They sit after every free/keyless public node, so they are
+// only hit when the entire free chain is down or throttled — the endpoint acts
+// as an insurance rung and its monthly credits stretch as long as possible.
+function lastResortUrls() {
+ return (process.env.SOLANA_RPC_LAST_RESORT_URLS || '')
+ .split(',')
+ .map((s) => normalizeRpcUrl(s))
+ .filter(Boolean);
+}
+
/**
* Priority-ordered endpoint list for a network. An explicit `url` (the value a
* call site already resolved) is pinned first; keyed providers, then any
* operator-supplied SOLANA_RPC_FALLBACK_URLS, then the keyless public endpoints
- * follow as fallbacks. The most-throttled public endpoint is always last.
+ * follow as fallbacks, with the most-throttled public endpoint at the end of the
+ * free set. Any SOLANA_RPC_LAST_RESORT_URLS (paid metered endpoints held in
+ * reserve) come after ALL free endpoints, so they only serve when everything
+ * free is down.
*/
export function solanaRpcEndpoints(network = 'mainnet', url = null) {
const key = process.env.HELIUS_API_KEY;
@@ -253,6 +269,10 @@ export function solanaRpcEndpoints(network = 'mainnet', url = null) {
'https://solana-mainnet.gateway.tatum.io',
'https://solana.therpc.io',
PUBLIC_MAINNET,
+ // Paid metered reserve (mainnet only — devnet URLs would cross clusters).
+ // Dead last BY DESIGN: these bill against a monthly quota, so they serve
+ // only when every free lane above is down or throttled at once.
+ ...lastResortUrls(),
// .filter(isHttpUrl) is the hard guarantee: only a value `new Connection`
// accepts survives, so a malformed env entry can never reach the constructor.
]).filter(isHttpUrl);
diff --git a/api/cron/[name].js b/api/cron/[name].js
index 90a9fd118..b316f9741 100644
--- a/api/cron/[name].js
+++ b/api/cron/[name].js
@@ -638,6 +638,11 @@ const PUBLIC_RPCS = {
function idxRpcUrls(chainId) {
const envUrl = process.env[`RPC_URL_${chainId}`];
+ // Paid metered reserve (e.g. a Quicknode credit-funded endpoint) appended
+ // AFTER every free public fallback: it bills against a monthly quota, so it
+ // should only serve when the whole free chain is down or throttled — the
+ // inverse of RPC_URL_<chainId>, which is tried first.
+ const lastResortUrl = process.env[`RPC_URL_${chainId}_LAST_RESORT`];
const ankrKey = process.env.ANKR_API_KEY;
// Ankr sunset keyless access: every https://rpc.ankr.com/<chain> call now
// returns "Unauthorized: authenticate with an API key", so a keyless entry
@@ -657,7 +662,9 @@ function idxRpcUrls(chainId) {
return ankrKey ? `${url}/${ankrKey}` : null;
})
.filter(Boolean);
- return envUrl ? [envUrl, ...fallbacks] : fallbacks;
+ const urls = envUrl ? [envUrl, ...fallbacks] : fallbacks;
+ if (lastResortUrl && !urls.includes(lastResortUrl)) urls.push(lastResortUrl);
+ return urls;
}
async function handleIndexDelegations(req, res) {
diff --git a/api/cron/changelog-push.js b/api/cron/changelog-push.js
new file mode 100644
index 000000000..efcb1ecd5
--- /dev/null
+++ b/api/cron/changelog-push.js
@@ -0,0 +1,69 @@
+// @ts-check
+// GET /api/cron/changelog-push — automatic changelog delivery to the holder
+// channels.
+//
+// Runs every 20 minutes. Reads the changelog feed baked into the running
+// image (public/changelog.json, regenerated by every deploy build), diffs it
+// against DB state, and posts anything new to the holders' Telegram channel
+// and the @trythreews X release thread. Because the feed ships inside the
+// image, entries go out shortly after the deploy that made them live, with
+// no manual `npm run changelog:push` step.
+//
+// Lanes degrade independently: a lane whose credentials are absent reports
+// { skipped: 'not_configured' } and the other still runs.
+// Telegram: TELEGRAM_BOT_TOKEN + TELEGRAM_CHANGELOG_CHAT_ID
+// X: X_API_KEY + X_API_SECRET + X_ACCESS_TOKEN + X_ACCESS_SECRET
+//
+// A DB lock (app_settings) keeps overlapping ticks from double-posting.
+// Selection, pacing, caps, and message formats live in
+// api/_lib/changelog-push.js; the manual scripts in scripts/changelog-*.mjs
+// remain for previews (--dry-run) and backfills only.
+
+import { error, json, method, wrapCron } from '../_lib/http.js';
+import { env } from '../_lib/env.js';
+import { constantTimeEquals } from '../_lib/crypto.js';
+import { acquireLock, releaseLock, loadFeed, pushTelegramLane, pushXLane } from '../_lib/changelog-push.js';
+
+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;
+}
+
+export default wrapCron(async (req, res) => {
+ if (!method(req, res, ['GET'])) return;
+ if (!requireCron(req, res)) return;
+
+ if (!(await acquireLock())) {
+ json(res, 200, { ok: true, skipped: 'locked' });
+ return;
+ }
+
+ let feed;
+ try {
+ feed = loadFeed();
+ } catch (err) {
+ await releaseLock().catch(() => {});
+ error(res, 500, 'feed_unreadable', String(err?.message || err));
+ return;
+ }
+
+ try {
+ const telegram = await pushTelegramLane(feed);
+ const x = await pushXLane(feed);
+ const failed = Boolean(telegram.error || x.error);
+ if (failed) console.warn('[cron] changelog-push lane error', { telegram, x });
+ json(res, failed ? 502 : 200, { ok: !failed, telegram, x });
+ } finally {
+ await releaseLock().catch(() => {});
+ }
+});
diff --git a/data/changelog.json b/data/changelog.json
index 19fed573e..e8234d834 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,16 @@
{
"$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-07-16",
+ "title": "Leave the page while your 3D model generates. We'll finish it and let you know",
+ "summary": "Generations no longer need a babysitter. If you close the tab or wander off mid-forge, the server now tracks your job to completion on its own: the finished model lands in your gallery automatically, and signed-in creators get a notification (bell, push, and email, each with its own switch in the preference center) the moment it's ready. Come back to /forge and an interrupted generation picks up right where it left off, with an honest elapsed timer. We also cleared over a thousand old generations that had been stuck in limbo and gave the busiest 3D engine room to scale to three GPUs, so queue waits drop too.",
+ "tags": [
+ "feature",
+ "improvement"
+ ],
+ "link": "/forge"
+ },
{
"date": "2026-07-16",
"title": "Sketch-to-3D is now live: draw it, get a 3D model",
diff --git a/docs/forge-background-generation.md b/docs/forge-background-generation.md
new file mode 100644
index 000000000..08931d53b
--- /dev/null
+++ b/docs/forge-background-generation.md
@@ -0,0 +1,66 @@
+# Background generation and completion notifications
+
+Forge generations are server-tracked to completion. You can start a generation
+on [/forge](https://three.ws/forge), close the tab, and the platform finishes
+the job, saves the model to your gallery, and tells you when it's ready.
+
+## What the user experiences
+
+- **Leave any time.** The generating panel says so explicitly. Navigating away
+ or closing the tab does not lose the job.
+- **Come back, pick up where you left off.** Returning to `/forge` within 30
+ minutes resumes the live progress view for the in-flight job (honest elapsed
+ timer included). The finished model also appears in the on-page gallery on
+ any later visit.
+- **Get notified.** Signed-in creators receive a notification when a
+ generation finishes unattended: the bell inbox and Web Push fire with a link
+ straight to the model, and an email goes out with a preview image. Failures
+ notify too (bell and push only). Every channel has its own switch under the
+ **Creations** category in the notification preference center. Anonymous
+ users aren't left out: their browser resumes the job from local storage and
+ the finished model is waiting in their gallery.
+
+Attended completions never notify. If the result appeared on your screen, the
+platform does not also push, email, or badge you about it.
+
+## How it works
+
+Three cooperating pieces:
+
+1. **Client resume** ([src/forge.js](../src/forge.js)): after a job is
+ submitted, its signed job token persists in `localStorage`
+ (`forge:inflight`). On page load the forge resumes polling that token; all
+ real state lives server-side, so a reload costs nothing. The record clears
+ on completion, terminal failure, or cancel.
+
+2. **Server-side finalizer** ([api/cron/forge-finalize.js](../api/cron/forge-finalize.js),
+ every minute via Cloud Scheduler): sweeps `forge_creations` rows still at
+ `status='generating'` after a 2-minute grace period. Rows whose job id is a
+ GCP worker envelope (the async self-host lanes: TRELLIS, Hunyuan3D,
+ TripoSG sketch) are polled directly on the worker: finished jobs are
+ materialized into durable storage with the exact same writer the browser
+ poll uses (`materializeCreation`), failed jobs are marked failed. Anything
+ non-terminal after 45 minutes is marked failed as timed out, so no row can
+ be orphaned at `generating` again.
+
+3. **Notifications** ([api/_lib/forge-notify.js](../api/_lib/forge-notify.js)):
+ the finalizer, and only the finalizer, notifies. `forge_complete` and
+ `forge_failed` are standard notification types in the `creations`
+ preference category (defaults: in-app on, push on, email on for
+ completions). Email delivery uses the platform Resend pipeline and skips
+ undeliverable placeholder addresses.
+
+## Operational notes
+
+- The finalizer needs `CRON_SECRET` (standard cron auth), `DATABASE_URL`, the
+ R2 `S3_*` storage vars, and `GCP_RECONSTRUCTION_KEY` to poll workers. With
+ no worker key it still reaps timed-out rows.
+- Batch size is 25 per tick (`FORGE_FINALIZE_BATCH` overrides). Ticks are
+ idempotent and safe to overlap.
+- The response body reports `{ swept, done, failed, timed_out, still_running,
+ unpollable }` per tick, so a quick manual hit shows queue health at a
+ glance.
+
+Related: [3d-pipeline.md](3d-pipeline.md) for the generation lanes themselves,
+and the notification preference model in
+[api/_lib/notify-prefs.js](../api/_lib/notify-prefs.js).
diff --git a/docs/start-here.md b/docs/start-here.md
index 297f12d6e..64d11b05c 100644
--- a/docs/start-here.md
+++ b/docs/start-here.md
@@ -60,6 +60,8 @@ If you're here to create and share agents rather than write code, follow this pa
Make something the community upvotes and it can reach beyond three.ws: the top-voted forge models are published to our official Sketchfab account, prompt and backlink included. See [Sketchfab showcase](./sketchfab.md).
+Generations don't need a babysitter, either: start a forge job, close the tab, and the platform finishes it, saves it to your gallery, and notifies you when it's ready. See [Background generation](./forge-background-generation.md).
+
---
## Ready to build?
diff --git a/src/forge.js b/src/forge.js
index cfd84f164..4349af1ab 100644
--- a/src/forge.js
+++ b/src/forge.js
@@ -1529,6 +1529,11 @@ async function startJob({ prompt, imageUrls, skipValidation, payment }) {
async function pollUntilDone(jobId) {
const deadline = performance.now() + MAX_POLL_MS;
+ // Queue-state tracking: when the engine reports the job is waiting for a GPU
+ // (healthy but busy, one generation per instance), say so instead of showing
+ // a silent spinner that reads as a hang. Restored when the job starts running.
+ let inQueue = false;
+ let preQueueMeshLabel = null;
while (!pollAbort && performance.now() < deadline) {
await sleep(POLL_INTERVAL_MS);
if (pollAbort) return null;
diff --git a/tests/api/solana-rpc-endpoints.test.js b/tests/api/solana-rpc-endpoints.test.js
index a6c2278b1..b3349753f 100644
--- a/tests/api/solana-rpc-endpoints.test.js
+++ b/tests/api/solana-rpc-endpoints.test.js
@@ -23,6 +23,7 @@ const KEYS = [
'DRPC_API_KEY',
'SOLANA_RPC_URL',
'SOLANA_RPC_FALLBACK_URLS',
+ 'SOLANA_RPC_LAST_RESORT_URLS',
];
describe('solanaRpcEndpoints', () => {
@@ -113,6 +114,31 @@ describe('solanaRpcEndpoints', () => {
// And the public mainnet-beta endpoint is still last.
expect(eps[eps.length - 1]).toBe('https://api.mainnet-beta.solana.com');
});
+
+ it('places SOLANA_RPC_LAST_RESORT_URLS after EVERY free endpoint (paid quota preserved)', () => {
+ // The paid metered reserve (e.g. the Quicknode credit-funded endpoint) must
+ // only serve when the whole free chain is down — so it sits dead last, even
+ // behind the most-throttled public mainnet-beta endpoint.
+ process.env.HELIUS_API_KEY = 'h_test';
+ process.env.SOLANA_RPC_FALLBACK_URLS = 'https://free-a.example/sol';
+ process.env.SOLANA_RPC_LAST_RESORT_URLS =
+ 'https://paid.quiknode.example/abc , https://paid-2.example/sol';
+ const eps = solanaRpcEndpoints('mainnet');
+ expect(eps[eps.length - 2]).toBe('https://paid.quiknode.example/abc');
+ expect(eps[eps.length - 1]).toBe('https://paid-2.example/sol');
+ expect(eps.indexOf('https://api.mainnet-beta.solana.com')).toBeLessThan(
+ eps.indexOf('https://paid.quiknode.example/abc'),
+ );
+ expect(eps.indexOf('https://free-a.example/sol')).toBeLessThan(
+ eps.indexOf('https://paid.quiknode.example/abc'),
+ );
+ });
+
+ it('never leaks SOLANA_RPC_LAST_RESORT_URLS into the devnet list (no cluster bleed)', () => {
+ process.env.SOLANA_RPC_LAST_RESORT_URLS = 'https://paid.quiknode.example/abc';
+ const eps = solanaRpcEndpoints('devnet');
+ expect(eps).not.toContain('https://paid.quiknode.example/abc');
+ });
});
// Regression guard for the production club-cover outage: a misconfigured primary
diff --git a/vercel.json b/vercel.json
index d214c660d..b0ae5b64a 100644
--- a/vercel.json
+++ b/vercel.json
@@ -5394,6 +5394,10 @@
{
"path": "/api/cron/leaderboard-rollup",
"schedule": "0 9 * * *"
+ },
+ {
+ "path": "/api/cron/changelog-push",
+ "schedule": "*/20 * * * *"
}
]
}