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.

test: green the agent-wallet trade/import suites + drop dead hub placeholder

originolsdeb3133c86f3
diff --git a/src/agent-wallet-hub/tabs/_placeholder.js b/src/agent-wallet-hub/tabs/_placeholder.js
deleted file mode 100644
index 4569ff1e0..000000000
--- a/src/agent-wallet-hub/tabs/_placeholder.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Agent Wallet hub — placeholder tab factory.
- *
- * The Balance tab ships fully built in this task. Deposit, Trade, Snipe, Pay, and
- * Withdraw are honest "coming online" placeholders that the later epic tasks
- * (02/04/06/08/09) replace by overwriting their own tab file. Each placeholder is
- * a real, designed empty-state — it tells the user exactly what the section will
- * do and that it is arriving, never a blank void or a fake/disabled control.
- */
-
-import { registerWalletTab } from '../registry.js';
-
-const PH_STYLE_ID = 'awh-placeholder-style';
-const PH_STYLE = `
-.awh-ph { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-3,12px); }
-.awh-ph-icon { width: 38px; height: 38px; border-radius: var(--radius-md,10px); display: grid; place-items: center; background: var(--surface-2, rgba(255,255,255,.05)); border: 1px solid var(--stroke, rgba(255,255,255,.08)); font-size: 18px; }
-.awh-ph h2 { margin: 0; font-size: var(--text-lg,1.236rem); color: var(--ink-bright,#fff); font-family: var(--font-display, system-ui); }
-.awh-ph p { margin: 0; color: var(--ink-dim,#888); font-size: var(--text-md,.8125rem); line-height: var(--leading-normal,1.618); max-width: 52ch; }
-`;
-function injectPlaceholderStyle() {
- if (typeof document === 'undefined' || document.getElementById(PH_STYLE_ID)) return;
- const tag = document.createElement('style');
- tag.id = PH_STYLE_ID;
- tag.textContent = PH_STYLE;
- document.head.appendChild(tag);
-}
-
-/**
- * Register a "coming online" placeholder tab.
- * @param {{ id, label, order, ownerOnly?, icon, title, body }} def
- */
-export function registerPlaceholderTab(def) {
- registerWalletTab({
- id: def.id,
- label: def.label,
- order: def.order,
- ownerOnly: !!def.ownerOnly,
- mount({ panel, ctx }) {
- injectPlaceholderStyle();
- const { escapeHtml } = ctx;
- panel.innerHTML = `
- <div class="awh-card">
- <div class="awh-ph">
- <div class="awh-ph-icon" aria-hidden="true">${escapeHtml(def.icon || '◎')}</div>
- <span class="awh-placeholder-badge">Coming online</span>
- <h2>${escapeHtml(def.title)}</h2>
- <p>${escapeHtml(def.body)}</p>
- </div>
- </div>
- `;
- return {};
- },
- });
-}
diff --git a/tests/agent-trade-endpoint.test.js b/tests/agent-trade-endpoint.test.js
index 43548970b..b31b5a9e3 100644
--- a/tests/agent-trade-endpoint.test.js
+++ b/tests/agent-trade-endpoint.test.js
@@ -54,6 +54,14 @@ vi.mock('../api/_lib/avatar-wallet.js', () => ({
vi.mock('../api/_lib/audit.js', () => ({ logAudit: vi.fn() }));
+// CSRF is enforced on the live (non-simulate) trade path; the token round-trip is
+// covered by its own suite. Here we stub it to a pass so these tests exercise the
+// trade logic, exactly as auth/rate-limit/db are mocked above.
+vi.mock('../api/_lib/csrf.js', () => ({
+ requireCsrf: vi.fn(async () => true),
+ issueCsrf: vi.fn(async () => 'csrf-test-token'),
+}));
+
const authState = { session: { id: 'owner-1' }, bearer: null };
vi.mock('../api/_lib/auth.js', () => ({
getSessionUser: vi.fn(async () => authState.session),
diff --git a/tests/api/solana-wallet-import.test.js b/tests/api/solana-wallet-import.test.js
index c7955351f..411d380cd 100644
--- a/tests/api/solana-wallet-import.test.js
+++ b/tests/api/solana-wallet-import.test.js
@@ -25,6 +25,14 @@ vi.mock('../../api/_lib/rate-limit.js', () => ({
clientIp: vi.fn(() => '127.0.0.1'),
}));
+// CSRF is enforced on the state-changing import/clear paths; its token round-trip
+// has dedicated coverage in security-csrf-gates. Stub it to a pass so these tests
+// exercise the import validation logic, as auth/db/rate-limit are mocked above.
+vi.mock('../../api/_lib/csrf.js', () => ({
+ requireCsrf: vi.fn(async () => true),
+ issueCsrf: vi.fn(async () => 'csrf-test-token'),
+}));
+
vi.mock('../../api/_lib/env.js', () => ({
env: { JWT_SECRET: 'test-secret-please-do-not-use-in-production-ever' },
}));
@@ -46,6 +54,10 @@ vi.mock('../../api/_lib/agent-wallet.js', () => ({
address: 'GeneratedAddr1111111111111111111111111111111',
encrypted_secret: 'mocked-cipher',
})),
+ // The import/clear paths encrypt the supplied secret with the dedicated
+ // custody key; the cipher itself is opaque to this test.
+ encryptSecret: vi.fn(async () => 'mocked-cipher'),
+ recoverSolanaAgentKeypair: vi.fn(async () => Keypair.generate()),
}));
const { default: handler } = await import('../../api/agents/solana-wallet.js');