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.

Wire micro-buy loop cron + skill-purchase updates

nirholascd5801d61eef
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3ffdaeca9..f0fb353f9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -53,6 +53,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Share a model, and whoever opens the link builds their own** — Forge something you like and hit Share: you now get a remix link. When a friend opens it, the homepage loads with your prompt already in the forge bar and starts building their own version on arrival, no typing and no sign-up. Any link of the form three.ws/?prompt=your idea works the same way, so you can hand-craft or bookmark them too. It turns every creation into an invitation: make something, share it, and the next person is one glance away from making their own. (The Open in Scene action still links your exact finished model.) `[feature]`
- **Sharing a model now shows a preview card and a real link** — When you share a forged model, the share panel now shows the exact preview card the link will unfurl as on X, Farcaster, and in chats, so you can see what people will see before you post. Every share is now a real permalink to your model with that card, instead of sometimes falling back to a generic link. Models forged right on the homepage are shareable the same way. (`/forge`) `[improvement]`
- **Sharper, cleaner models from photos** — Four upgrades to photo-to-3D landed together. Uploaded photos now have their background cleanly removed before reconstruction, so a busy backdrop no longer bleeds into the model. You can supply up to 6 reference angles instead of 4 for fuller coverage. Every uploaded angle is now quality-checked, and a blurry or off-subject one is dropped instead of corrupting the result. And every finished model runs through an automatic geometry cleanup pass that welds and de-duplicates the mesh and trims redundant triangles, so models load faster and render cleaner with no loss of detail. (`/image-to-3d`) `[improvement, feature]`
+- **Skill purchases now finish on their own, and trials invite you to own the skill** — Two fixes to the marketplace buy flow. First, reliability: a paid skill purchase used to be finalized only by your browser polling for about a minute after you paid, so if you closed the tab (or paid from a mobile QR and walked away) the on-chain payment could land while the purchase sat unfinished, with no skill unlocked and nothing shown in the Money Pulse. A new server-side sweep now watches for each payment on-chain and completes the purchase for you within a couple of minutes, whether or not your browser is still open. Second, conversion: starting a free trial, or running out of trial uses, now offers a one-tap Own it path straight into checkout, instead of a dead-end message. (`/marketplace`) `[fix, improvement]`
- **The 3D world looks sharper and shows more of the plaza** — Two fixes to how the world renders. First, sharpness: the world lowers render detail when frames get choppy (loading a crowded plaza, a tab hiccup, a background sync), but it could only ever step down and never recovered, so a single rough moment left the 3D permanently soft on high-resolution screens while the interface on top stayed crisp. It now climbs back to your device's full sharpness once frames are smooth again, and it re-tunes automatically when you drag the window between a laptop screen and an external monitor. Second, framing: the follow camera was zoomed in tight, cropping the totem and side screens at the edges. It now uses a wider lens so you see more of the plaza and the crowd around you at once. (`/play`) `[fix, improvement]`
- **The agent-to-agent payment economy runs far cheaper and now cycles hundreds of distinct payers** — Two improvements to the closed-loop x402 agent economy that dogfoods every paid endpoint on the platform. First, a fix: a background wallet-consolidation job was quietly closing the ring's payment account after every settlement, forcing the next one to recreate it and pay account rent each time. That single bug had pushed the real fee cost to roughly a hundred times where it should be. With it fixed and single-signature settlement turned on, each settlement is back to the network floor of a few thousandths of a cent, and the ring's working balance stays in the loop instead of leaking away. Second, a new capability: the ring can now cycle payments through a reusable pool of hundreds to a thousand distinct wallets instead of one, so the economy reads as many participants rather than a single account, with no extra cost per payment. The pool is off until funded and activated, and every wallet in it stays clearly labeled internal dogfooding, not organic demand. (`/admin/ring`) `[fix, improvement, infra]`
- **The autonomous-trading scoreboard now counts only real on-chain trades** — The homepage's live trading panel promises "real positions, no simulation", so its headline numbers now come only from trades that actually landed on-chain. Winning exits, best run, best ROI, and open positions all exclude paper (simulated) fills, which the engine writes while it runs in practice mode. Nothing is inflated: the board shows the true count of profitable trades agents have closed for real, and it moves the instant a genuine winning exit lands. `[fix, improvement]`
diff --git a/api/cron/[name].js b/api/cron/[name].js
index b316f9741..a53050107 100644
--- a/api/cron/[name].js
+++ b/api/cron/[name].js
@@ -67,6 +67,7 @@ import { fetchSafePublicUrl } from '../_lib/ssrf-guard.js';
import { runPumpAlertRules } from '../_lib/pump-alert-runner.js';
import { constantTimeEquals } from '../_lib/crypto.js';
import { publishUserEvent } from '../_lib/feed.js';
+import { confirmSkillPurchase } from '../_lib/purchase-confirm.js';
// ─── Cron auth ───────────────────────────────────────────────────────────────
//
@@ -113,6 +114,7 @@ const HANDLERS = {
'solana-attest-event-cleanup': handleSolanaAttestEventCleanup,
'solana-attestations-crawl': handleSolanaAttestationsCrawl,
'expire-pending-purchases': handleExpirePendingPurchases,
+ 'confirm-pending-purchases': handleConfirmPendingPurchases,
'cleanup-csrf-tokens': handleCleanupCsrfTokens,
'process-withdrawals': handleProcessWithdrawals,
'monetization-payouts': handleProcessWithdrawals,
@@ -3347,6 +3349,73 @@ async function handleExpirePendingPurchases(req, res) {
return json(res, 200, { expired: result.length });
}
+// ═══════════════════════════════════════════════════════════════════════════
+// confirm-pending-purchases: server-side settlement sweep for paid skill buys.
+// Schedule: every 2 minutes (well inside the 30-minute pending TTL, so a paid
+// purchase confirms long before expire-pending-purchases fail-closes it).
+//
+// Why this exists: a paid purchase is otherwise confirmed ONLY by the buyer's
+// browser polling /api/marketplace/purchase/confirm for ~60s after it broadcasts
+// the payment. If the tab closes, the network stalls, or a mobile Solana-Pay QR
+// buyer pays and walks away, the on-chain payment lands but the row stays
+// 'pending': the buyer is charged, gets no skill grant, and the sale never
+// reaches the Money Pulse. This sweep locates each pending paid row's payment by
+// its Solana-Pay reference and finalizes it exactly like the buyer poll would
+// (idempotent: finalizeSkillConfirmation flips the row only from 'pending', and
+// re-confirms are no-ops). Solana only; EVM confirm needs the buyer's tx hash.
+// ═══════════════════════════════════════════════════════════════════════════
+
+async function handleConfirmPendingPurchases(req, res) {
+ if (!method(req, res, ['GET'])) return;
+ if (!requireCron(req, res)) return;
+
+ // Only rows that (a) are a real paid purchase, (b) settle on Solana, (c) are
+ // still within their pending window, and (d) are recent enough that a payment
+ // could plausibly have landed. mint_decimals rides in from the price row so the
+ // on-chain amount check matches the quote. LIMIT bounds the per-tick RPC work;
+ // the next tick continues any remainder.
+ const pending = await sql`
+ SELECT sp.id, sp.user_id, sp.agent_id, sp.skill, sp.status, sp.reference,
+ sp.amount, sp.currency_mint, sp.chain, sp.tx_signature,
+ sp.expires_at, sp.referrer_user_id, sp.recipient_user_id,
+ sp.platform_fee_amount, sp.platform_fee_wallet,
+ COALESCE(asp.mint_decimals, 6) AS mint_decimals
+ FROM skill_purchases sp
+ LEFT JOIN agent_skill_prices asp
+ ON asp.agent_id = sp.agent_id AND asp.skill = sp.skill
+ WHERE sp.status = 'pending'
+ AND sp.kind IN ('purchase', 'time_pass')
+ AND sp.chain = 'solana'
+ AND (sp.expires_at IS NULL OR sp.expires_at > now())
+ AND sp.created_at > now() - interval '2 hours'
+ ORDER BY sp.created_at ASC
+ LIMIT 50
+ `;
+
+ let confirmed = 0, tipped = 0, mismatched = 0, stillPending = 0, errors = 0;
+ for (const pur of pending) {
+ try {
+ const r = await confirmSkillPurchase(pur);
+ if (r.status === 'confirmed') confirmed++;
+ else if (r.status === 'tipped') tipped++;
+ else if (r.status === 'mismatch') mismatched++;
+ else stillPending++; // 'pending' (no on-chain payment yet) or 'expired'
+ } catch (e) {
+ errors++;
+ console.error('[confirm-pending-purchases] confirm failed', pur.reference, e?.message);
+ }
+ }
+
+ return json(res, 200, {
+ scanned: pending.length,
+ confirmed,
+ tipped,
+ mismatched,
+ still_pending: stillPending,
+ errors,
+ });
+}
+
// ═══════════════════════════════════════════════════════════════════════════
// cleanup-csrf-tokens — drop expired tokens. Run hourly.
// ═══════════════════════════════════════════════════════════════════════════
diff --git a/data/changelog.json b/data/changelog.json
index fd3c85326..d65949059 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-17",
+ "title": "Skill purchases now finish on their own, and trials invite you to own the skill",
+ "summary": "Two fixes to the marketplace buy flow. First, reliability: a paid skill purchase used to be finalized only by your browser polling for about a minute after you paid, so if you closed the tab (or paid from a mobile QR and walked away) the on-chain payment could land while the purchase sat unfinished, with no skill unlocked and nothing shown in the Money Pulse. A new server-side sweep now watches for each payment on-chain and completes the purchase for you within a couple of minutes, whether or not your browser is still open. Second, conversion: starting a free trial, or running out of trial uses, now offers a one-tap Own it path straight into checkout, instead of a dead-end message.",
+ "tags": [
+ "fix",
+ "improvement"
+ ],
+ "link": "/marketplace"
+ },
{
"date": "2026-07-17",
"title": "A steady drip of $THREE buys, paid through the x402 loop",
diff --git a/public/changelog.json b/public/changelog.json
index a5fd1b3ef..0b47fefd1 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-07-17T23:54:17.071Z",
+ "generated_at": "2026-07-18T00:00:08.778Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -500,6 +500,17 @@
"feature"
]
},
+ {
+ "date": "2026-07-17",
+ "type": "update",
+ "title": "Skill purchases now finish on their own, and trials invite you to own the skill",
+ "summary": "Two fixes to the marketplace buy flow. First, reliability: a paid skill purchase used to be finalized only by your browser polling for about a minute after you paid, so if you closed the tab (or paid from a mobile QR and walked away) the on-chain payment could land while the purchase sat unfinished, with no skill unlocked and nothing shown in the Money Pulse. A new server-side sweep now watches for each payment on-chain and completes the purchase for you within a couple of minutes, whether or not your browser is still open. Second, conversion: starting a free trial, or running out of trial uses, now offers a one-tap Own it path straight into checkout, instead of a dead-end message.",
+ "link": "/marketplace",
+ "tags": [
+ "fix",
+ "improvement"
+ ]
+ },
{
"date": "2026-07-17",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index b45d5d30f..2c09100c8 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -382,6 +382,14 @@
<category>improvement</category>
<description>Four upgrades to photo-to-3D landed together. Uploaded photos now have their background cleanly removed before reconstruction, so a busy backdrop no longer bleeds into the model. You can supply up to 6 reference angles instead of 4 for fuller coverage. Every uploaded angle is now quality-checked, and a blurry or off-subject one is dropped instead of corrupting the result. And every finished model runs through an automatic geometry cleanup pass that welds and de-duplicates the mesh and trims redundant triangles, so models load faster and render cleaner with no loss of detail.</description>
</item>
+ <item>
+ <title>Skill purchases now finish on their own, and trials invite you to own the skill</title>
+ <link>https://three.ws/marketplace</link>
+ <guid isPermaLink="false">2026-07-17:Skill purchases now finish on their own, and trials invite you to own the skill</guid>
+ <pubDate>Fri, 17 Jul 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>Two fixes to the marketplace buy flow. First, reliability: a paid skill purchase used to be finalized only by your browser polling for about a minute after you paid, so if you closed the tab (or paid from a mobile QR and walked away) the on-chain payment could land while the purchase sat unfinished, with no skill unlocked and nothing shown in the Money Pulse. A new server-side sweep now watches for each payment on-chain and completes the purchase for you within a couple of minutes, whether or not your browser is still open. Second, conversion: starting a free trial, or running out of trial uses, now offers a one-tap Own it path straight into checkout, instead of a dead-end message.</description>
+ </item>
<item>
<title>The 3D world looks sharper and shows more of the plaza</title>
<link>https://three.ws/play</link>
diff --git a/public/features.json b/public/features.json
index f245257f2..d6fb7a6c9 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-07-17T23:54:17.056Z",
+ "generated_at": "2026-07-18T00:00:08.765Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/src/shared/skill-purchase.js b/src/shared/skill-purchase.js
index b106c3397..4530f1e56 100644
--- a/src/shared/skill-purchase.js
+++ b/src/shared/skill-purchase.js
@@ -766,13 +766,24 @@ export async function openTrialFlow(agentId, skill, btn) {
const j = await r.json().catch(() => ({}));
if (!r.ok) {
if (j.error === 'already_owned') showToast('You already own this skill.', { type: 'info' });
- else if (j.error === 'trial_used') showToast('You have already used the trial for this skill.', { type: 'warning' });
+ else if (j.error === 'trial_used') showToast('Your free trial of this skill is used up. Own it forever to keep using it.', {
+ type: 'warning',
+ duration: 9000,
+ // The highest-intent conversion moment: the user came back to use the
+ // skill and has no trials left. Offer the paid path inline instead of a
+ // dead-end warning; opens the real purchase flow.
+ action: { label: 'Own it', onClick: (dismiss) => { dismiss?.(); openPurchaseFlow(agentId, skill); } },
+ });
else if (r.status === 401) { location.href = `/login?next=${encodeURIComponent(location.pathname)}`; return; }
else showToast(j.error_description || j.error || 'Failed to start trial', { type: 'error' });
return;
}
await cfg.onPurchased(agentId);
- showToast(`Free trial of ${skill} started.`, { type: 'success' });
+ // Trial is the hook; keep the paid path one tap away while intent is highest.
+ showToast(`Free trial of ${skill} started.`, {
+ type: 'success',
+ action: { label: 'Own it forever', onClick: (dismiss) => { dismiss?.(); openPurchaseFlow(agentId, skill); } },
+ });
} catch (err) {
showToast(err.message || 'Failed to start trial', { type: 'error' });
} finally {
diff --git a/vercel.json b/vercel.json
index 0733c30af..3888448c0 100644
--- a/vercel.json
+++ b/vercel.json
@@ -2435,7 +2435,7 @@
"dest": "/api/okx/3d/[service]?service=$1"
},
{
- "src": "/api/cron/(audit-log-cleanup|cleanup-csrf-tokens|club-payouts|cosmetic-splits-sweep|erc8004-crawl|expire-pending-purchases|fetch-x-metrics|index-delegations|irl-drops-refund|monetization-payouts|process-subscriptions|process-withdrawals|pump-agent-stats|pumpfun-graduations-sync|pumpfun-monitor|pumpfun-signals|run-buyback|run-coin-cycle|run-coin-payouts|run-dca|run-distribute-payments|run-subscriptions|run-three-buyback|run-x-scheduled-posts|run-x-triggers|settle-royalties|siwx-gc|solana-agents-crawl|solana-attest-event-cleanup|solana-attestations-crawl|treasury-autopilot|unstoppable-tick)",
+ "src": "/api/cron/(audit-log-cleanup|cleanup-csrf-tokens|club-payouts|confirm-pending-purchases|cosmetic-splits-sweep|erc8004-crawl|expire-pending-purchases|fetch-x-metrics|index-delegations|irl-drops-refund|monetization-payouts|process-subscriptions|process-withdrawals|pump-agent-stats|pumpfun-graduations-sync|pumpfun-monitor|pumpfun-signals|run-buyback|run-coin-cycle|run-coin-payouts|run-dca|run-distribute-payments|run-subscriptions|run-three-buyback|run-x-scheduled-posts|run-x-triggers|settle-royalties|siwx-gc|solana-agents-crawl|solana-attest-event-cleanup|solana-attestations-crawl|treasury-autopilot|unstoppable-tick)",
"dest": "/api/cron/[name]?name=$1"
},
{
@@ -5185,6 +5185,10 @@
"path": "/api/cron/expire-pending-purchases",
"schedule": "*/5 * * * *"
},
+ {
+ "path": "/api/cron/confirm-pending-purchases",
+ "schedule": "*/2 * * * *"
+ },
{
"path": "/api/cron/uptime-check",
"schedule": "*/5 * * * *"