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.

fix(deploy): unbreak HEAD by dropping imports of modules that were never committed

nirholas11ff463f8eb3
diff --git a/api/agents/_id/credits.js b/api/agents/_id/credits.js
index 553ec8f28..e36f1a9b2 100644
--- a/api/agents/_id/credits.js
+++ b/api/agents/_id/credits.js
@@ -16,8 +16,7 @@
// Bearer callers need `wallet:write` to move funds or change the rule and
// `wallet:read` (or `profile`) to read; a browser session is the owner itself.
// The move is api/_lib/inference-topup.js; the read model is
-// api/_lib/inference-billing.js; the rule is api/_lib/inference-autofund.js over
-// api/_lib/wallet-intents.js.
+// api/_lib/inference-billing.js; the rule is api/_lib/wallet-intents.js.
import { getSessionUser, authenticateBearer, extractBearer, hasScope } from '../../_lib/auth.js';
import { sql } from '../../_lib/db.js';
@@ -26,7 +25,7 @@ import { requireCsrf } from '../../_lib/csrf.js';
import { limits, clientIp } from '../../_lib/rate-limit.js';
import { inferenceUsage, autoFundIntent } from '../../_lib/inference-billing.js';
import { previewTopup, executeTopup, reconcilePendingTopups } from '../../_lib/inference-topup.js';
-import { saveAutoFund } from '../../_lib/inference-autofund.js';
+import { normalizeIntent, createIntent, updateIntent, describeIntent } from '../../_lib/wallet-intents.js';
async function resolveCaller(req) {
const session = await getSessionUser(req);
@@ -131,9 +130,34 @@ async function handleAutoFund(req, res, caller, agent) {
if (!rl.success) return rateLimited(res, rl);
const body = (await readJson(req).catch(() => null)) || {};
- try {
- return json(res, 200, await saveAutoFund({ agentId: agent.id, userId: caller.userId, input: body }));
- } catch (err) {
- return sendTyped(res, err);
+ const current = await autoFundIntent(agent.id);
+ const enabled = body.enabled !== false;
+
+ // Turning an absent rule off is a no-op, not an error.
+ if (!current && !enabled) return json(res, 200, { auto_fund: null });
+
+ const threshold = body.threshold_usd ?? current?.threshold_usd;
+ const amount = body.amount_usdc ?? current?.amount_usdc;
+ const norm = normalizeIntent({
+ title: 'Keep the agent thinking',
+ trigger_type: 'credits_below',
+ trigger_config: { threshold_usd: threshold },
+ action_type: 'fund_inference',
+ action_config: { amount_usdc: amount },
+ limits: {
+ per_action_usd: amount,
+ daily_usd: body.daily_usd ?? current?.limits?.daily_usd ?? amount,
+ total_usd: body.total_usd ?? current?.limits?.total_usd ?? null,
+ },
+ });
+ if (!norm.ok) return error(res, 400, norm.error, norm.message);
+ const readback = describeIntent(norm.intent);
+ norm.intent.readback = readback;
+
+ if (current) {
+ await updateIntent(agent.id, caller.userId, current.intent_id, { intent: norm.intent, enabled });
+ } else {
+ await createIntent(agent.id, caller.userId, norm.intent, { sourceText: readback });
}
+ return json(res, 200, { auto_fund: await autoFundIntent(agent.id), readback });
}
diff --git a/api/payments/_config.js b/api/payments/_config.js
index b28610481..c41e2f946 100644
--- a/api/payments/_config.js
+++ b/api/payments/_config.js
@@ -2,16 +2,18 @@
// Prices are set in USD. On-chain settlement is USDC (6 decimals on EVM and
// Solana), native SOL, or $THREE (Solana-only; see PLAN_ASSETS below).
-import { PLANS as PLAN_ROWS, BILLING_PERIOD_DAYS } from '../_lib/plans.js';
+import { readFileSync } from 'node:fs';
+
+const PLANS_DATA = JSON.parse(readFileSync(new URL('../../data/plans.json', import.meta.url), 'utf8'));
// Purchasable plans, priced from data/plans.json (the single source the
// /pricing page, the docs and the quota checks also read), so checkout always
// quotes the number the pricing page shows.
export const PLANS = Object.freeze(
Object.fromEntries(
- PLAN_ROWS.filter((p) => p.purchasable).map((p) => [
+ PLANS_DATA.plans.filter((p) => p.purchasable).map((p) => [
p.id,
- Object.freeze({ label: p.name, price_usd: p.price_usd, duration_days: BILLING_PERIOD_DAYS }),
+ Object.freeze({ label: p.name, price_usd: p.price_usd, duration_days: PLANS_DATA.billing_period_days }),
]),
),
);
diff --git a/api/payments/solana/[action].js b/api/payments/solana/[action].js
index 26bfb5e19..150687c5b 100644
--- a/api/payments/solana/[action].js
+++ b/api/payments/solana/[action].js
@@ -17,7 +17,6 @@ import {
INTENT_TTL_MINUTES, QUOTED_INTENT_TTL_MINUTES,
planPriceUsd, threePlanDiscountBps,
} from '../_config.js';
-import { forgetUserPlan } from '../../_lib/plans.js';
const SOLANA_RPC_MAINNET = process.env.SOLANA_RPC_URL || 'https://api.mainnet-beta.solana.com';
const SOLANA_RPC_DEVNET = process.env.SOLANA_RPC_URL_DEVNET || 'https://api.devnet.solana.com';
@@ -254,8 +253,6 @@ async function handleConfirm(req, res) {
sql`update users set plan=${intent.plan} where id=${user.id}`,
]);
if (!claimed?.[0]) return error(res, 409, 'already_confirmed', 'payment already confirmed');
- // The new plan's limits and rate limit apply from the very next request.
- forgetUserPlan(user.id);
queueMicrotask(() => sendSubscriptionConfirmEmail({ to: user.email, plan: intent.plan, chain: `Solana ${network}`, txId: tx_signature }).catch(() => {}));
return json(res, 200, { ok: true, plan: intent.plan, asset, active_until: activeUntil.toISOString(), tx_signature });
}
diff --git a/api/v1/agent-mail.js b/api/v1/agent-mail.js
index 74ab04971..88fabe98b 100644
--- a/api/v1/agent-mail.js
+++ b/api/v1/agent-mail.js
@@ -16,8 +16,6 @@
* POST /api/v1/agents/:id/mail/messages/:msg/read { read: true|false }
* DELETE /api/v1/agents/:id/mail/messages/:msg
* GET /api/v1/agents/:id/mail/messages/:msg/attachments/:index short-lived download URL
- * GET /api/v1/agents/:id/mail/chat email-as-chat status for this mailbox
- * POST /api/v1/agents/:id/mail/chat { enabled: true|false } pair or unpair the account email
*
* Envelope (the v1 contract): success { data, meta: { requestId, timestamp } },
* failure { error: { code, message, details }, meta }.
@@ -34,7 +32,6 @@ import { authenticateBearer, extractBearer, getSessionUser, hasScope } from '../
import { checkCsrf } from '../_lib/csrf.js';
import { limits, clientIp } from '../_lib/rate-limit.js';
import * as mail from '../_lib/mail/service.js';
-import { emailChatStatus, setEmailChat } from '../_lib/gateway/email.js';
const READ_SCOPE = 'agents:read';
const WRITE_SCOPE = 'agents:write';
@@ -135,8 +132,6 @@ const ROUTES = [
['GET', 'messages/:msg/attachments/:index', READ_SCOPE, (c) => mail.attachmentDownloadUrl({
userId: c.userId, agentId: c.agentId, messageId: c.params.msg, index: c.params.index,
})],
- ['GET', 'chat', READ_SCOPE, (c) => emailChatStatus({ userId: c.userId, agentId: c.agentId })],
- ['POST', 'chat', WRITE_SCOPE, (c) => setEmailChat({ userId: c.userId, agentId: c.agentId, enabled: c.body.enabled !== false })],
].map(([m, pattern, scope, handler, status = 200]) => ({ method: m, parts: pattern.split('/').filter(Boolean), scope, handler, status }));
/** Match method + segments. Returns { route, params }, { methodMismatch }, or null. */
diff --git a/vercel.json b/vercel.json
index 3cbb9a914..b1f6eb2c0 100644
--- a/vercel.json
+++ b/vercel.json
@@ -330,10 +330,6 @@
"src": "/agent-cards/?",
"dest": "/agent-cards.html"
},
- {
- "src": "/agent-mail/?",
- "dest": "/agent-mail.html"
- },
{
"src": "/wallet",
"dest": "/wallet.html"
@@ -5174,10 +5170,6 @@
"src": "/agents/[^/.]+/cards/?",
"dest": "/agent-cards.html"
},
- {
- "src": "/agents/[^/.]+/mail/?",
- "dest": "/agent-mail.html"
- },
{
"src": "/agents/([^/.]+)/classic/?",
"dest": "/agent-detail-classic.html"
diff --git a/vite.config.js b/vite.config.js
index 69ec00fd3..b92d51d0b 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -788,7 +788,6 @@ const appConfig = {
monitor: resolve(__dirname, 'pages/monitor.html'),
'agent-wallet': resolve(__dirname, 'pages/agent-wallet.html'),
'agent-cards': resolve(__dirname, 'pages/agent-cards.html'),
- 'agent-mail': resolve(__dirname, 'pages/agent-mail.html'),
wallet: resolve(__dirname, 'pages/wallet.html'),
guardian: resolve(__dirname, 'pages/guardian.html'),
launches: resolve(__dirname, 'pages/launches.html'),
@@ -2280,9 +2279,6 @@ const appConfig = {
// /agents/:id/cards and /agent-cards → Agent Cards (gift + prepaid cards).
else if (!filePath && /^\/(agents\/[^/.]+\/cards|agent-cards)\/?$/.test(path))
filePath = resolve(root, 'pages/agent-cards.html');
- // /agents/:id/mail and /agent-mail → Agent Mail (the agent's inbox).
- else if (!filePath && /^\/(agents\/[^/.]+\/mail|agent-mail)\/?$/.test(path))
- filePath = resolve(root, 'pages/agent-mail.html');
// /agents/:id/classic → the preserved pre-redesign profile layout
else if (!filePath && /^\/agents?\/[^/.]+\/classic\/?$/.test(path))
filePath = resolve(root, 'pages/agent-detail-classic.html');