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: add SNS subdomain registration and enhance dashboard navigation

nirholas12769ff88223
diff --git a/api/_lib/skill-runtime.js b/api/_lib/skill-runtime.js
index c57bcbe95..59b25f149 100644
--- a/api/_lib/skill-runtime.js
+++ b/api/_lib/skill-runtime.js
@@ -66,16 +66,27 @@ async function loadManifest(name) {
export function makeRuntime(opts = {}) {
const { configOverrides = {}, wallet, onEvent, fetch = globalThis.fetch, agentId, signerAddress } = opts;
let _sql;
+ // Map skill-internal tags to canonical action types so existing
+ // aggregations (spend-policy, portfolio cost-basis) keep working.
+ function canonicalType(skillName, tag) {
+ const [, op] = (tag ?? '').split(':');
+ if (skillName === 'pump-fun-trade') {
+ if (op === 'buy') return 'pumpfun.buy';
+ if (op === 'sell') return 'pumpfun.sell';
+ if (op === 'create') return 'pumpfun.create';
+ }
+ return op || tag || 'note';
+ }
+
async function persistAction(skillName, tag, value) {
if (!agentId) return;
try {
if (!_sql) _sql = (await import('./db.js')).sql;
- const [, type] = (tag ?? '').split(':'); // e.g. 'pump-fun-trade:buy' → 'buy'
await _sql`
INSERT INTO agent_actions (agent_id, type, payload, source_skill, signature, signer_address)
VALUES (
${agentId},
- ${type || tag || 'note'},
+ ${canonicalType(skillName, tag)},
${JSON.stringify(value ?? {})}::jsonb,
${skillName},
${value?.sig ?? null},
diff --git a/api/agents/[id].js b/api/agents/[id].js
index d7982d2a4..b2659de7f 100644
--- a/api/agents/[id].js
+++ b/api/agents/[id].js
@@ -5,6 +5,7 @@
* /api/agents/:id/solana/activity — recent on-chain signatures for the wallet
* /api/agents/:id/solana/airdrop — devnet airdrop (1 SOL)
* /api/agents/:id/sns — list owned .sol domains and attach one as the agent's SNS id
+ * /api/agents/:id/sns/register — mint a free subdomain under the platform's parent .sol
* /api/agents/:id/pumpfun/launch — create a pump.fun token from this agent
* /api/agents/:id/pumpfun/buy — bonding-curve buy
* /api/agents/:id/pumpfun/sell — bonding-curve sell
@@ -44,7 +45,7 @@ export default wrap(async function handler(req, res) {
if (sub === 'sns') {
const mod = await import('./sns.js');
- return mod.default(req, res, id);
+ return mod.default(req, res, id, action);
}
if (sub === 'pumpfun') {
diff --git a/api/pump/portfolio.js b/api/pump/portfolio.js
index 386c93870..ab9e7ecf5 100644
--- a/api/pump/portfolio.js
+++ b/api/pump/portfolio.js
@@ -68,8 +68,7 @@ export default wrap(async (req, res) => {
sql`
SELECT payload, created_at FROM agent_actions
WHERE agent_id = ${agentId}
- AND source_skill = 'pump-fun-trade'
- AND type = 'buy'
+ AND type IN ('pumpfun.buy', 'buy')
ORDER BY created_at DESC
LIMIT 500
`.catch(() => []),
diff --git a/examples/skills/pump-fun-strategy/handlers.js b/examples/skills/pump-fun-strategy/handlers.js
index feab875aa..2fcf0842d 100644
--- a/examples/skills/pump-fun-strategy/handlers.js
+++ b/examples/skills/pump-fun-strategy/handlers.js
@@ -71,6 +71,10 @@ export async function runStrategy(args, ctx) {
const perTrade = compiled.entry.amountSol ?? ctx?.skillConfig?.defaultPerTradeSol ?? 0.05;
const pollMs = ctx?.skillConfig?.defaultPollMs ?? 5000;
const onLog = typeof args.onLog === 'function' ? args.onLog : () => {};
+ // Optional async guard: returns null to allow, or { code, msg } to block.
+ const policyGuard = typeof args.policyGuard === 'function' ? args.policyGuard : null;
+ // Optional abort signal: when set, the loop terminates at the next safe point.
+ const abortSignal = args.abortSignal ?? null;
const seen = new Set();
const positions = new Map();
@@ -80,6 +84,7 @@ export async function runStrategy(args, ctx) {
const emit = (entry) => { log.push(entry); try { onLog(entry); } catch {} };
while (Date.now() < deadline) {
+ if (abortSignal?.aborted) { emit({ action: 'aborted' }); break; }
emit({ action: 'tick', t: Date.now(), open: positions.size, spent });
// 1. Watch exits on open positions.
@@ -123,6 +128,13 @@ export async function runStrategy(args, ctx) {
emit({ mint, action: 'skip', view });
continue;
}
+ if (policyGuard && !simulate) {
+ const block = await policyGuard({ mint, amountSol: perTrade });
+ if (block) {
+ emit({ mint, action: 'policy-block', code: block.code, reason: block.msg });
+ continue;
+ }
+ }
try {
const buy = await maybeBuy(ctx, simulate, mint, perTrade);
spent += perTrade;
diff --git a/public/dashboard/agent-pumpfun.html b/public/dashboard/agent-pumpfun.html
index d9e2ce33b..3ac89e44b 100644
--- a/public/dashboard/agent-pumpfun.html
+++ b/public/dashboard/agent-pumpfun.html
@@ -355,6 +355,18 @@
>Register a name on sns.id</a
>
</div>
+ <div id="sns-registrar" class="row" style="margin-top: 14px; align-items: flex-end" hidden>
+ <div class="field">
+ <label for="sns-register-label">Claim a free subdomain</label>
+ <div class="row" style="gap: 6px">
+ <input id="sns-register-label" placeholder="myagent" maxlength="63" />
+ <span id="sns-register-suffix" class="muted" style="font-family: ui-monospace, Menlo, monospace; font-size: 13px"></span>
+ </div>
+ </div>
+ <div style="flex: 0 0 auto">
+ <button class="btn" id="sns-register-btn">Claim</button>
+ </div>
+ </div>
</section>
<section class="panel">
@@ -535,6 +547,10 @@
snsRefreshBtn: $('#sns-refresh-btn'),
snsClearBtn: $('#sns-clear-btn'),
snsRegisterLink: $('#sns-register-link'),
+ snsRegistrar: $('#sns-registrar'),
+ snsRegisterLabel: $('#sns-register-label'),
+ snsRegisterSuffix: $('#sns-register-suffix'),
+ snsRegisterBtn: $('#sns-register-btn'),
launchName: $('#launch-name'),
launchSymbol: $('#launch-symbol'),
launchVanity: $('#launch-vanity'),
@@ -738,9 +754,14 @@
if (!id) return;
els.snsCurrent.textContent = '…';
els.snsDomainList.innerHTML = '';
+ els.snsRegistrar.hidden = true;
try {
const { data } = await api(`/api/agents/${id}/sns`);
renderSnsList(data);
+ if (data.registrar?.enabled) {
+ els.snsRegistrar.hidden = false;
+ els.snsRegisterSuffix.textContent = `.${data.registrar.parent}.sol`;
+ }
} catch (err) {
els.snsCurrent.textContent =
err.body?.error === 'conflict'
@@ -751,6 +772,32 @@
}
}
+ async function registerSns() {
+ const id = currentAgentId();
+ if (!id) return;
+ const label = els.snsRegisterLabel.value.trim().toLowerCase();
+ if (!/^[a-z0-9-]{1,63}$/.test(label)) {
+ toast('Label must be a–z, 0–9, or hyphen (max 63 chars)', 'err');
+ return;
+ }
+ els.snsRegisterBtn.disabled = true;
+ els.snsRegisterBtn.textContent = 'Claiming…';
+ try {
+ const { data } = await api(`/api/agents/${id}/sns/register`, {
+ method: 'POST',
+ body: JSON.stringify({ label }),
+ });
+ toast(`Registered ${data.sns_domain}.sol`);
+ els.snsRegisterLabel.value = '';
+ await refreshSns();
+ } catch (err) {
+ toast(err.message, 'err');
+ } finally {
+ els.snsRegisterBtn.disabled = false;
+ els.snsRegisterBtn.textContent = 'Claim';
+ }
+ }
+
async function attachSns(domain) {
const id = currentAgentId();
if (!id) return;
@@ -991,6 +1038,7 @@
els.provisionBtn.addEventListener('click', provision);
els.snsRefreshBtn.addEventListener('click', refreshSns);
els.snsClearBtn.addEventListener('click', clearSns);
+ els.snsRegisterBtn.addEventListener('click', registerSns);
els.launchBtn.addEventListener('click', launchToken);
els.buyBtn.addEventListener('click', buy);
els.sellBtn.addEventListener('click', sell);
diff --git a/public/dashboard/index.html b/public/dashboard/index.html
index c10cabe82..af5ea2a31 100644
--- a/public/dashboard/index.html
+++ b/public/dashboard/index.html
@@ -1142,6 +1142,10 @@
<a href="/dashboard/wallets">Wallets</a>
<a href="/vanity-wallet">Vanity wallet ✦</a>
<a href="/dashboard/agent-pumpfun">Agent · Pump.fun</a>
+ <a href="/strategy-lab">Strategy lab</a>
+ <a href="/reputation">Reputation</a>
+ <a href="/settings">Settings</a>
+ <a href="/admin">Admin</a>
<a href="/discover" title="Browse on-chain agents across every supported chain"
>Discover on-chain ↗</a
>
diff --git a/vercel.json b/vercel.json
index 16fe3be24..dc7f3933f 100644
--- a/vercel.json
+++ b/vercel.json
@@ -153,6 +153,17 @@
{ "src": "/lobehub/iframe/", "dest": "/lobehub/iframe/index.html" },
{ "src": "/lobehub/iframe/(.*)", "dest": "/lobehub/iframe/$1" },
+ { "src": "/strategy-lab", "dest": "/strategy-lab.html" },
+ { "src": "/reputation", "dest": "/reputation/index.html" },
+ { "src": "/reputation/", "dest": "/reputation/index.html" },
+ { "src": "/reputation/(.*)", "dest": "/reputation/$1" },
+ { "src": "/settings", "dest": "/settings/index.html" },
+ { "src": "/settings/", "dest": "/settings/index.html" },
+ { "src": "/settings/(.*)", "dest": "/settings/$1" },
+ { "src": "/admin", "dest": "/admin/index.html" },
+ { "src": "/admin/", "dest": "/admin/index.html" },
+ { "src": "/admin/(.*)", "dest": "/admin/$1" },
+
{ "src": "/api/auth/logout-everywhere", "dest": "/api/auth/logout-everywhere" },
{ "src": "/api/auth/verify-email", "dest": "/api/auth/verify-email" },
{ "src": "/api/auth/forgot-password", "dest": "/api/auth/forgot-password" },