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
chore: treasury, memory-store, and agent-detail follow-ups
nirholas0011871e320b
diff --git a/api/_lib/coin/treasury.js b/api/_lib/coin/treasury.jsindex cba9bc425..0700329be 100644--- a/api/_lib/coin/treasury.js+++ b/api/_lib/coin/treasury.js@@ -71,11 +71,22 @@ export async function loadCoinCreatorFromCoin(coin) {}// Legacy: a plaintext base64 secret was stored before at-rest encryption.- // Honor it so existing launches keep working, but make the exposure visible.+ // Honor it so existing launches keep working, but make the exposure LOUD —+ // page ops (deduped) until `scripts/reencrypt-creator-keys.mjs --apply` runs.console.warn(`[coin/treasury] mint ${coin.mint}: creator_secret_b64 is stored UNENCRYPTED. ` +- 'Re-store it through the launcher (it now encrypts at rest) to remove the plaintext key.',+ 'Run scripts/reencrypt-creator-keys.mjs --apply to remove the plaintext key.',);+ import('../alerts.js')+ .then(({ sendOpsAlert }) =>+ sendOpsAlert(+ 'Unencrypted pump.fun creator key in use',+ 'A coin_launches row still holds a plaintext creator_secret_b64. ' ++ 'Run scripts/reencrypt-creator-keys.mjs --apply to encrypt it at rest.',+ { signature: 'plaintext-creator-key' },+ ),+ )+ .catch(() => {});return decodeB64Keypair(dbValue, 'coin.metadata.creator_secret_b64 (legacy plaintext)');}diff --git a/scripts/reencrypt-creator-keys.mjs b/scripts/reencrypt-creator-keys.mjsnew file mode 100644index 000000000..32e3e00e2--- /dev/null+++ b/scripts/reencrypt-creator-keys.mjs@@ -0,0 +1,103 @@+#!/usr/bin/env node+/**+ * One-time sweep: re-encrypt any plaintext pump.fun creator keys at rest.+ *+ * Pre-encryption launches stored coin_launches.metadata.creator_secret_b64 as+ * raw base64 plaintext. Those keys sign collectCreatorFee — a DB snapshot, log,+ * or read-replica leak hands over live signing keys. This sweep encrypts every+ * plaintext value via the same AES-256-GCM scheme the launcher now uses+ * (encryptSecret → "v2:"-prefixed blob) and writes it back, leaving no plaintext.+ *+ * SAFE BY DEFAULT: dry-run unless --apply is passed. Reads DATABASE_URL and+ * WALLET_ENCRYPTION_KEY from env / .env.local / .env.+ *+ * Usage:+ * node scripts/reencrypt-creator-keys.mjs # report what would change+ * node scripts/reencrypt-creator-keys.mjs --apply # encrypt + persist+ */++import { readFileSync } from 'node:fs';+import { fileURLToPath } from 'node:url';+import path from 'node:path';+import { neon } from '@neondatabase/serverless';++const HERE = path.dirname(fileURLToPath(import.meta.url));+const REPO_ROOT = path.resolve(HERE, '..');++for (const envFile of ['.env.local', '.env']) {+ try {+ const raw = readFileSync(path.resolve(REPO_ROOT, envFile), 'utf8');+ for (const line of raw.split('\n')) {+ const m = line.match(/^([A-Z_][A-Z0-9_]*)=(.*)$/);+ if (!m || process.env[m[1]]) continue;+ let val = m[2].trim();+ if ((val.startsWith('"') && val.endsWith('"')) || (val.startsWith("'") && val.endsWith("'")))+ val = val.slice(1, -1);+ process.env[m[1]] = val;+ }+ break;+ } catch { /* not present */ }+}++const APPLY = process.argv.includes('--apply');++if (!process.env.DATABASE_URL) {+ console.error('DATABASE_URL is not set.');+ process.exit(2);+}+if (!process.env.WALLET_ENCRYPTION_KEY || process.env.WALLET_ENCRYPTION_KEY.length < 32) {+ console.error('WALLET_ENCRYPTION_KEY must be set (>=32 chars) to encrypt creator keys.');+ process.exit(2);+}++// Imported AFTER env is loaded so secret-box resolves the master key correctly.+const { encryptSecret, isEncryptedSecret } = await import('../api/_lib/secret-box.js');++const sql = neon(process.env.DATABASE_URL);++async function main() {+ const rows = await sql`+ SELECT id, mint, metadata+ FROM coin_launches+ WHERE metadata ? 'creator_secret_b64'+ AND metadata->>'creator_secret_b64' IS NOT NULL+ `;++ let plaintext = 0;+ let alreadyEncrypted = 0;+ let updated = 0;++ for (const row of rows) {+ const value = row.metadata?.creator_secret_b64;+ if (!value) continue;+ if (isEncryptedSecret(value)) {+ alreadyEncrypted++;+ continue;+ }+ plaintext++;+ console.log(` plaintext creator key — coin ${row.id} (mint ${row.mint})`);+ if (!APPLY) continue;++ const encrypted = await encryptSecret(value);+ const nextMeta = { ...row.metadata, creator_secret_b64: encrypted };+ await sql`+ UPDATE coin_launches+ SET metadata = ${JSON.stringify(nextMeta)}::jsonb+ WHERE id = ${row.id}+ `;+ updated++;+ }++ console.log('');+ console.log(`Scanned ${rows.length} launch(es) with a creator key.`);+ console.log(` already encrypted: ${alreadyEncrypted}`);+ console.log(` plaintext: ${plaintext}`);+ if (APPLY) console.log(` re-encrypted: ${updated}`);+ else if (plaintext) console.log(`\nRe-run with --apply to encrypt ${plaintext} plaintext key(s).`);+ else console.log('\nNothing to do — no plaintext keys found.');+}++main().catch((e) => {+ console.error('FAILED:', e.message);+ process.exitCode = 1;+});diff --git a/src/agent-detail.js b/src/agent-detail.jsindex cea18dd36..4e7dade6a 100644--- a/src/agent-detail.js+++ b/src/agent-detail.js@@ -1431,7 +1431,7 @@ async function renderOracleTrackRecord(agentId) {row.href = a.oracle_url || `https://three.ws/oracle?mint=${a.mint}`;row.target = '_blank';row.rel = 'noopener noreferrer';- row.innerHTML = `<span class="ad-trade-outcome ${outcome}"></span><span class="ad-trade-symbol">$${(a.symbol || '?').toUpperCase()}</span><span class="ad-trade-tier">${tierE} ${a.tier || ''}</span><span class="ad-trade-peak">${peak}</span><span class="ad-trade-pnl ${pnlVal != null && pnlVal >= 0 ? 'positive' : pnlVal != null ? 'negative' : ''}">${pnlText}</span>`;+ row.innerHTML = `<span class="ad-trade-outcome ${outcome}"></span><span class="ad-trade-symbol">$${escapeText((a.symbol || '?').toUpperCase())}</span><span class="ad-trade-tier">${tierE} ${escapeText(a.tier || '')}</span><span class="ad-trade-peak">${peak}</span><span class="ad-trade-pnl ${pnlVal != null && pnlVal >= 0 ? 'positive' : pnlVal != null ? 'negative' : ''}">${pnlText}</span>`;histEl.appendChild(row);}}