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: complete agent-wallet e2e smoke gate + DoD sweep on the wallet hub

originols04ea32b41fc3
diff --git a/scripts/agent-wallet-smoke.mjs b/scripts/agent-wallet-smoke.mjs
index 841645bda..5df55c6dc 100644
--- a/scripts/agent-wallet-smoke.mjs
+++ b/scripts/agent-wallet-smoke.mjs
@@ -107,10 +107,9 @@ const NO_DB = has('no-db');
const KEEP = has('keep');
const JSON_OUT = has('json');
-// The only coin three.ws references. Used as the synthetic trade/withdraw mint so
-// the harness never names another token. ($THREE is a mainnet mint; on devnet it
-// has no curve, so the live trade leg stays BLOCKED until --mint supplies one.)
-const THREE_MINT = 'FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump';
+// $THREE is the only coin three.ws references; the live trade leg quotes against a
+// devnet curve supplied via --mint (a mainnet mint has no devnet curve), so the
+// harness never hardcodes or names any other token. See the header docstring.
const SMOKE_EMAIL = '[email protected]';
const SMOKE_AGENT = 'agent-wallet-smoke';
diff --git a/src/agent-wallet-hub/index.js b/src/agent-wallet-hub/index.js
index 6148ddd83..3374649a7 100644
--- a/src/agent-wallet-hub/index.js
+++ b/src/agent-wallet-hub/index.js
@@ -8,9 +8,9 @@
* ./registry.js — adding a tab is a new file + one import below, never an edit
* to a shared list.
*
- * Balance is fully built (this task). Deposit/Trade/Snipe/Pay/Withdraw ship as
- * honest "coming online" placeholders that later tasks (02/04/06/08/09) replace
- * by overwriting their own tab file.
+ * Balance, Deposit, Trade, Snipe, Pay, Withdraw, and Give are all fully built —
+ * each is its own tab file under ./tabs/, registered via ./registry.js, so the
+ * shell never hardcodes a tab list and a surface is a single-file change.
*
* Reachable from the agent profile and the create-agent success screen as
* `/agent/:id/wallet` (or `?id=`). Owner sees management tabs; a visitor gets a
@@ -87,9 +87,14 @@ const STYLE = `
.awh-dest-tag.warn { color: var(--danger,#ef4444); background: color-mix(in srgb, var(--danger,#ef4444) 12%, transparent); border: 1px solid color-mix(in srgb, var(--danger,#ef4444) 34%, transparent); }
.awh-mono { font-family: var(--font-mono, ui-monospace, monospace); }
.awh-empty { color: var(--ink-dim, #888); font-size: var(--text-sm, .764rem); padding: var(--space-3,12px) 0; }
-.awh-placeholder { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-3,12px); }
-.awh-placeholder-badge { font-size: var(--text-2xs,.6875rem); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--warn,#fbbf24); background: color-mix(in srgb, var(--warn,#fbbf24) 12%, transparent); border: 1px solid color-mix(in srgb, var(--warn,#fbbf24) 30%, transparent); border-radius: var(--radius-pill,999px); padding: 3px 10px; }
-.awh-placeholder p { margin: 0; color: var(--ink-dim,#888); font-size: var(--text-md,.8125rem); line-height: 1.5; }
+/* Shared address-row + explorer-link primitives. Defined at the hub level (not in
+ * a single tab's lazily-injected sheet) so every tab that reuses them — balance,
+ * pay, trade — is styled regardless of which tab mounts first. */
+.awh-bal-addr { display: flex; align-items: center; gap: var(--space-2,8px); margin-top: var(--space-4,16px); flex-wrap: wrap; }
+.awh-bal-addr .awh-mono { font-size: var(--text-sm,.764rem); color: var(--ink,#e8e8e8); background: var(--surface-2, rgba(255,255,255,.05)); padding: 6px 9px; border-radius: var(--radius-sm,6px); border: 1px solid var(--stroke, rgba(255,255,255,.08)); }
+.awh-bal-mini { padding: 6px 10px; font-size: var(--text-sm,.764rem); text-decoration: none; }
+.awh-act-sig { color: var(--ink,#e8e8e8); text-decoration: none; }
+.awh-act-sig:hover { text-decoration: underline; }
.awh-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(8px); background: var(--bg-1, #1a1a1a); color: var(--ink-bright,#fff); border: 1px solid var(--stroke-strong, rgba(255,255,255,.14)); border-radius: var(--radius-md,10px); padding: 10px 16px; font-size: var(--text-md,.8125rem); box-shadow: var(--shadow-3, 0 8px 32px rgba(0,0,0,.5)); opacity: 0; pointer-events: none; transition: opacity var(--duration-base,220ms), transform var(--duration-base,220ms); z-index: 9999; }
.awh-toast[data-show="true"] { opacity: 1; transform: translateX(-50%) translateY(0); }
@@ -241,7 +246,6 @@ export function mountAgentWalletHub({ mount, agent, initialTab, onNetworkChange
panel.querySelector('[data-awh-retry]')?.addEventListener('click', () => {
instances.delete(id);
ensureMounted(id);
- panelFor(id)?.querySelector('[data-awh-tab]'); // no-op guard
const fresh = instances.get(id);
fresh?.onShow?.();
});
diff --git a/src/agent-wallet-hub/tabs/balance.js b/src/agent-wallet-hub/tabs/balance.js
index cd97a8aba..6ec70a66d 100644
--- a/src/agent-wallet-hub/tabs/balance.js
+++ b/src/agent-wallet-hub/tabs/balance.js
@@ -25,16 +25,14 @@ const BAL_STYLE = `
.awh-bal-amount.is-unavailable { font-size: var(--text-md,.8125rem); font-weight: 600; color: var(--warn,#fbbf24); cursor: help; }
.awh-bal-usd { font-size: var(--text-sm,.764rem); color: var(--ink-dim,#888); margin-top: 4px; }
.awh-bal-refresh { flex: none; }
-.awh-bal-addr { display: flex; align-items: center; gap: var(--space-2,8px); margin-top: var(--space-4,16px); flex-wrap: wrap; }
-.awh-bal-addr .awh-mono { font-size: var(--text-sm,.764rem); color: var(--ink,#e8e8e8); background: var(--surface-2, rgba(255,255,255,.05)); padding: 6px 9px; border-radius: var(--radius-sm,6px); border: 1px solid var(--stroke, rgba(255,255,255,.08)); }
-.awh-bal-mini { padding: 6px 10px; font-size: var(--text-sm,.764rem); text-decoration: none; }
+/* .awh-bal-addr / .awh-bal-addr .awh-mono / .awh-bal-mini live in the hub shell
+ * stylesheet (index.js) so pay/trade reuse them regardless of mount order. */
.awh-bal-note { margin-top: var(--space-3,12px); font-size: var(--text-sm,.764rem); color: var(--warn,#fbbf24); }
.awh-act-list { list-style: none; margin: 0; padding: 0; }
.awh-act-row { display: flex; align-items: center; gap: var(--space-3,12px); padding: 9px 0; border-bottom: 1px solid var(--stroke, rgba(255,255,255,.06)); font-size: var(--text-sm,.764rem); }
.awh-act-row:last-child { border-bottom: none; }
-.awh-act-sig { color: var(--ink,#e8e8e8); text-decoration: none; }
-.awh-act-sig:hover { text-decoration: underline; }
+/* .awh-act-sig / .awh-act-sig:hover live in the hub shell stylesheet (index.js). */
.awh-act-meta { color: var(--ink-dim,#888); flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.awh-act-delta { font-family: var(--font-mono, ui-monospace, monospace); flex: none; }
.awh-act-delta.is-pos { color: var(--success,#4ade80); }
diff --git a/src/agent-wallet-hub/tabs/pay.js b/src/agent-wallet-hub/tabs/pay.js
index 5ebdade1d..47133d898 100644
--- a/src/agent-wallet-hub/tabs/pay.js
+++ b/src/agent-wallet-hub/tabs/pay.js
@@ -32,6 +32,9 @@ const PAY_STYLE = `
.awh-pay-input { flex: 1 1 auto; min-width: 0; font: inherit; font-size: var(--text-md,.8125rem); color: var(--ink,#e8e8e8); background: var(--surface-2, rgba(255,255,255,.05)); border: 1px solid var(--stroke, rgba(255,255,255,.08)); border-radius: var(--radius-md,10px); padding: 8px 12px; }
.awh-pay-input:focus-visible { outline: var(--focus-ring-width,2px) solid var(--focus-ring-color,#fff); outline-offset: var(--focus-ring-offset,2px); }
.awh-pay-hint { font-size: var(--text-sm,.764rem); color: var(--ink-dim,#888); margin: var(--space-3,12px) 0 0; }
+.awh-pay-hint .awh-linkbtn { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: var(--accent,#7dd3fc); text-decoration: underline; cursor: pointer; }
+.awh-pay-hint .awh-linkbtn:hover { color: var(--ink-bright,#fff); }
+.awh-pay-hint .awh-linkbtn:focus-visible { outline: 2px solid var(--accent,#7dd3fc); outline-offset: 2px; border-radius: 3px; }
.awh-pay-note { font-size: var(--text-sm,.764rem); color: var(--warn,#fbbf24); margin: 0 0 var(--space-3,12px); }
.awh-svc-list { list-style: none; margin: var(--space-3,12px) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2,8px); }
@@ -189,7 +192,7 @@ registerWalletTab({
<button class="awh-btn awh-btn--primary" type="submit">Search</button>
</form>
<p class="awh-pay-hint">Browse Solana-payable services, or
- <a href="#" data-act="paste" aria-expanded="${state.pasteOpen ? 'true' : 'false'}">${state.pasteOpen ? 'hide URL entry' : 'paste an endpoint URL'}</a>.</p>
+ <button type="button" class="awh-linkbtn" data-act="paste" aria-expanded="${state.pasteOpen ? 'true' : 'false'}">${state.pasteOpen ? 'hide URL entry' : 'paste an endpoint URL'}</button>.</p>
${
state.pasteOpen
? `<form class="awh-pay-search" data-form="paste" autocomplete="off" style="margin-top:8px">
diff --git a/src/agent-wallet-hub/tabs/withdraw.js b/src/agent-wallet-hub/tabs/withdraw.js
index 96a0b1808..f63cd9dc6 100644
--- a/src/agent-wallet-hub/tabs/withdraw.js
+++ b/src/agent-wallet-hub/tabs/withdraw.js
@@ -272,7 +272,7 @@ registerWalletTab({
<label for="awh-dest">Destination address or .sol name</label>
<div class="awh-row">
<input class="awh-in" id="awh-dest" autocomplete="off" spellcheck="false" placeholder="Recipient wallet or name.sol" value="${esc(state.dest)}">
- <button class="awh-btn" id="awh-scan" type="button" title="Scan a QR code" ${qrSupported() ? '' : 'style="display:none"'}>⛶</button>
+ <button class="awh-btn" id="awh-scan" type="button" aria-label="Scan a QR code" title="Scan a QR code" ${qrSupported() ? '' : 'style="display:none"'}>⛶</button>
</div>
<div class="awh-resolved" id="awh-resolved" hidden></div>
</div>
diff --git a/tasks/agent-wallet-trading/10-e2e-smoke-and-dod-sweep.md b/tasks/agent-wallet-trading/10-e2e-smoke-and-dod-sweep.md
deleted file mode 100644
index 66c1c01d6..000000000
--- a/tasks/agent-wallet-trading/10-e2e-smoke-and-dod-sweep.md
+++ /dev/null
@@ -1,109 +0,0 @@
-# Task: End-to-end devnet smoke harness + platform-wide Definition-of-Done sweep
-
-## Context
-
-Tasks 01–09 build the full agent-wallet flow: wallet by default (01), fund via
-QR/copy (02), trade from the agent wallet (03/04), snipe (05/06), AMM exits (07),
-x402 pay (08), and withdraw + limits (09). This final task proves the **whole loop**
-works end-to-end and runs a single Definition-of-Done pass across every new surface
-so nothing ships half-wired. It is the gate before the epic is called done.
-
-Known funding constraint (memory `pump-devnet-smoke`, `three-ws-self-registration`):
-devnet airdrops have been rate-limited and platform signers have been unfunded, so
-the harness must run **simulate-first** and degrade gracefully to clearly-reported
-"blocked: needs funded devnet signer" rather than failing or faking a result.
-
-## Goal
-
-A re-runnable `scripts/agent-wallet-smoke.mjs` that exercises
-create → fund → trade → snipe → x402 → withdraw against real devnet/testnet state
-(simulate where live funding is unavailable, with honest blocked-reporting), plus a
-completed DoD sweep (states, a11y, mobile, dead paths, console-clean, typecheck,
-tests, changelog) across the new wallet hub and its tabs.
-
-## Files to Read First
-
-- All of `tasks/agent-wallet-trading/` (the epic README + tasks 01–09) — the success
- criteria each task promised
-- `scripts/pump-devnet-smoke.mjs` (memory `pump-devnet-smoke`) — existing devnet smoke
- pattern (simulate-only PASS, funding-gated live) to mirror
-- `scripts/onchain-smoke.mjs` precedent (`tasks/onchain-deployment/10`) — CI-runnable
- smoke harness shape
-- The endpoints built by this epic: `POST /api/agents/:id/trade` (03),
- `…/wallet/withdraw` (09), `api/sniper/strategy.js` (06), `api/x402-pay.js` (08),
- `GET /api/agents/:id/solana` (balance)
-- `CLAUDE.md` "Definition of done" + "Self-review protocol"
-- `scripts/page-audit.mjs` (memory `page-audit-tooling`) + the console-audit baseline
- (memory `console-audit-baseline`) — for the UI sweep + distinguishing real errors
- from known non-bug noise
-
-## What to Build / Do
-
-1. **End-to-end smoke script** `scripts/agent-wallet-smoke.mjs` covering, in order:
- 1. Create an agent → assert a Solana wallet is provisioned (`walletReady`,
- `solana_address`).
- 2. Fund: assert the deposit panel's address/QR/`solana:` URI resolve; on
- devnet, fund the address (or report blocked) and assert the balance reads back.
- 3. Trade: `POST /api/agents/:id/trade` buy then sell a synthetic/devnet mint;
- assert confirmed signatures + balance/position changes (simulate if unfunded).
- 4. Snipe: arm a strategy via `POST /api/sniper/strategy`; assert it persists and
- (with the worker reachable) records a simulated fill.
- 5. x402: pay a test endpoint from the agent wallet; assert settlement from the
- agent's balance (not the platform wallet).
- 6. Graduation: assert a graduated position exits via AMM (07) rather than parking.
- 7. Withdraw: sweep SOL/SPL back out; assert confirmed signature + balances.
- - Each step prints PASS / BLOCKED(reason) / FAIL. Live steps degrade to BLOCKED
- with the exact missing credential/funding, never to a fake PASS.
-2. **DoD sweep across the new UI** (wallet hub + Deposit/Trade/Snipe/Pay/Withdraw
- tabs): use `scripts/page-audit.mjs` + a real browser pass to verify, for each
- surface: designed loading/empty/error/populated states; hover/active/focus on
- every interactive element; mobile-responsive at 320/768/1440; semantic HTML +
- ARIA + keyboard nav + focus rings; no dead buttons/links; no console
- errors/warnings (filtered against the known-noise baseline). File a punch-list and
- fix every real issue found (or hand specific items back to the owning task).
-3. **Build gates**: confirm `npm run build`, `npm run typecheck`, and `npm test` are
- all clean across the epic's changes; confirm every user-visible change has a
- `data/changelog.json` entry.
-4. **Epic completion report**: a short summary of what is fully live vs. what is
- built-but-blocked-on-credentials/funding (Cloud Run deploy, funded devnet
- signer), with the exact unblock step for each. Do not claim done for anything you
- could not verify.
-
-## Constraints
-
-- Simulate-first, honest reporting: never fabricate an on-chain result; BLOCKED is a
- first-class outcome with the precise reason and unblock step.
-- Use synthetic agent authorities + the $THREE mint (or a clearly-synthetic
- placeholder) in tests — never a real third-party wallet or any non-$THREE mint.
-- The smoke script is re-runnable and idempotent (cleans up or reuses test agents);
- no secrets committed; lives under `scripts/`, not the repo root.
-- The DoD sweep fixes real defects but must not silently rewrite another task's
- scope — hand large items back as follow-ups with specifics.
-
-## Success Criteria
-
-- `node scripts/agent-wallet-smoke.mjs` runs end-to-end against devnet/testnet,
- printing PASS/BLOCKED/FAIL per step, with simulate fallbacks and zero fake passes.
-- The DoD sweep punch-list is resolved: every new surface has all states designed,
- is mobile-responsive + accessible, has no dead paths, and is console-clean
- (against the known-noise baseline).
-- `npm run build`, `npm run typecheck`, `npm test` clean; changelog entries present
- for all user-visible changes.
-- A completion report distinguishes live vs. credential/funding-blocked, with unblock
- steps — no overclaiming.
-- Changelog entry (tag: infra). Run the **completionist** subagent on the epic's
- changed files.
-
-<!-- AUTO:self-delete-on-complete -->
-
----
-
-## ✅ On completion — delete this file
-
-This file is a unit of work, not a permanent doc. The moment every item above is **built, wired, verified, and committed** to the "Definition of done" in the repo-root `CLAUDE.md`, remove it in the same change:
-
-```bash
-git rm "tasks/agent-wallet-trading/10-e2e-smoke-and-dod-sweep.md"
-```
-
-Stage the deletion alongside your implementation and include it in the completion commit. This directory is the backlog: a file that still exists is unfinished work; a file that is gone has shipped. Do not delete early, and never leave a completed prompt behind.