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
feat(accessibility): enhance ARIA roles and attributes for improved screen reader support across multiple tabs
fudjiaef69b870a48f
diff --git a/src/agent-wallet-hub/index.js b/src/agent-wallet-hub/index.jsindex 4b49d9585..7272c4285 100644--- a/src/agent-wallet-hub/index.js+++ b/src/agent-wallet-hub/index.js@@ -70,6 +70,7 @@ const STYLE = `.awh-tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: thin; border-bottom: 1px solid var(--stroke, rgba(255,255,255,.08)); padding-bottom: 0; -webkit-overflow-scrolling: touch; }.awh-tab { appearance: none; font: inherit; font-size: var(--text-md, .8125rem); font-weight: 500; color: var(--ink-dim, #888); background: transparent; border: none; border-bottom: 2px solid transparent; padding: 10px 14px; cursor: pointer; white-space: nowrap; transition: color var(--duration-fast, 140ms) var(--ease-standard, ease), border-color var(--duration-fast, 140ms) var(--ease-standard, ease), background var(--duration-fast, 140ms) var(--ease-standard, ease); border-radius: var(--radius-sm, 6px) var(--radius-sm, 6px) 0 0; }.awh-tab:hover { color: var(--ink, #e8e8e8); background: var(--surface-1, rgba(255,255,255,.03)); }+.awh-tab:active { color: var(--ink-bright, #fff); background: var(--surface-2, rgba(255,255,255,.05)); }.awh-tab[aria-selected="true"] { color: var(--ink-bright, #fff); border-bottom-color: var(--accent, #fff); }.awh-tab:focus-visible { outline: var(--focus-ring-width, 2px) solid var(--focus-ring-color, #fff); outline-offset: -2px; }diff --git a/src/agent-wallet-hub/tabs/autopilot.js b/src/agent-wallet-hub/tabs/autopilot.jsindex 09dd5672e..1b13baa47 100644--- a/src/agent-wallet-hub/tabs/autopilot.js+++ b/src/agent-wallet-hub/tabs/autopilot.js@@ -221,11 +221,11 @@ registerWalletTab({function render() {if (destroyed) return;if (state.loading) {- panel.innerHTML = `<div class="ap-wrap"><div class="ap-card"><div class="ap-skel" style="width:40%"></div><div class="ap-skel"></div><div class="ap-skel" style="width:80%"></div></div><div class="ap-card"><div class="ap-skel" style="width:30%"></div><div class="ap-skel"></div></div></div>`;+ panel.innerHTML = `<div class="ap-wrap" role="status" aria-busy="true" aria-label="Loading Autopilot"><div class="ap-card"><div class="ap-skel" style="width:40%"></div><div class="ap-skel"></div><div class="ap-skel" style="width:80%"></div></div><div class="ap-card"><div class="ap-skel" style="width:30%"></div><div class="ap-skel"></div></div></div>`;return;}if (state.error) {- panel.innerHTML = `<div class="ap-wrap"><div class="ap-err">Couldn’t load Autopilot: ${esc(state.error)}</div><div class="ap-actions"><button class="ap-btn" id="ap-retry">Retry</button></div></div>`;+ panel.innerHTML = `<div class="ap-wrap"><div class="ap-err" role="alert">Couldn’t load Autopilot: ${esc(state.error)}</div><div class="ap-actions"><button class="ap-btn" id="ap-retry" type="button">Retry</button></div></div>`;panel.querySelector('#ap-retry')?.addEventListener('click', load);return;}@@ -264,8 +264,8 @@ registerWalletTab({const maxV = Math.max(incomeUsd, costUsd, 0.01);const bars = `<div class="ap-bars">- <div class="ap-bar-row"><span class="k">Income</span><span class="ap-bar income"><i style="width:${Math.round((incomeUsd / maxV) * 100)}%"></i></span><span class="v">${formatUsd(incomeUsd)}</span></div>- <div class="ap-bar-row"><span class="k">Compute</span><span class="ap-bar cost"><i style="width:${Math.round((costUsd / maxV) * 100)}%"></i></span><span class="v">${formatUsd(costUsd)}</span></div>+ <div class="ap-bar-row"><span class="k">Income</span><span class="ap-bar income" aria-hidden="true"><i style="width:${Math.round((incomeUsd / maxV) * 100)}%"></i></span><span class="v">${formatUsd(incomeUsd)}</span></div>+ <div class="ap-bar-row"><span class="k">Compute</span><span class="ap-bar cost" aria-hidden="true"><i style="width:${Math.round((costUsd / maxV) * 100)}%"></i></span><span class="v">${formatUsd(costUsd)}</span></div></div>`;const stats = `@@ -278,20 +278,20 @@ registerWalletTab({<div class="ap-stat"><div class="l">Swept to you</div><div class="n">${formatSol(r.swept_sol || 0)} SOL</div><div class="s">${r.sweep_count || 0} sweeps</div></div></div>`;- return `<div class="ap-hero">+ return `<div class="ap-hero" role="region" aria-label="Treasury runway"><div class="ap-hero-top"><div>${badge}</div>${net}</div>- <div class="ap-runway">${heroMain}</div>+ <div class="ap-runway" aria-live="polite">${heroMain}</div>${(incomeUsd > 0 || costUsd > 0) ? bars : ''}${stats}</div>`;}function renderKilledBanner() {- return `<div class="ap-warn red"><strong>Autopilot is halted.</strong> The kill switch is on — no rule will run until you re-enable it.- <div class="ap-actions"><button class="ap-btn primary" id="ap-unkill">Re-enable autopilot</button></div></div>`;+ return `<div class="ap-warn red" role="alert"><strong>Autopilot is halted.</strong> The kill switch is on — no rule will run until you re-enable it.+ <div class="ap-actions"><button class="ap-btn primary" id="ap-unkill" type="button">Re-enable autopilot</button></div></div>`;}function renderEditor() {@@ -303,26 +303,26 @@ registerWalletTab({const preview = c? `<div style="margin-top:var(--space-md,14px)">- ${hasRules ? `<ul class="ap-rules">${c.rules.map((r) => renderRuleLi(r, false)).join('')}</ul>` : `<div class="ap-empty"><div class="ic">🤔</div>No rules were recognized. Try a clearer policy.</div>`}- ${contradictions.length ? `<div class="ap-warn red"><strong>Conflicts — fix before arming:</strong><ul>${contradictions.map((w) => `<li>${esc(w)}</li>`).join('')}</ul></div>` : ''}+ ${hasRules ? `<ul class="ap-rules">${c.rules.map((r) => renderRuleLi(r, false)).join('')}</ul>` : `<div class="ap-empty"><div class="ic" aria-hidden="true">🤔</div>No rules were recognized. Try a clearer policy.</div>`}+ ${contradictions.length ? `<div class="ap-warn red" role="alert"><strong>Conflicts — fix before arming:</strong><ul>${contradictions.map((w) => `<li>${esc(w)}</li>`).join('')}</ul></div>` : ''}${warnings.length ? `<div class="ap-warn amber"><strong>Assumptions:</strong><ul>${warnings.map((w) => `<li>${esc(w)}</li>`).join('')}</ul></div>` : ''}${c.via ? `<p class="sub" style="margin-top:8px">Compiled ${c.via === 'model' ? 'by the model' : 'from your wording'}. Review every rule — this is exactly what you’ll arm.</p>` : ''}</div>`: '';return `<div class="ap-card">- <h3>Treasury policy</h3>+ <h3 id="ap-policy-h">Treasury policy</h3><p class="sub">Describe in plain English how the agent should manage its own money. We compile it into bounded rules you approve before anything runs.</p>- <textarea class="ap-ta" id="ap-src" placeholder="e.g. Pay your own compute. Keep a 1 SOL buffer. Put 10% of tips into $THREE. Sweep anything over 3 SOL to me on Fridays.">${esc(state.source)}</textarea>- <div class="ap-egs">${EXAMPLES.map((e, i) => `<button class="ap-eg" data-eg="${i}">${esc(e.length > 54 ? e.slice(0, 52) + '…' : e)}</button>`).join('')}</div>+ <textarea class="ap-ta" id="ap-src" aria-labelledby="ap-policy-h" placeholder="e.g. Pay your own compute. Keep a 1 SOL buffer. Put 10% of tips into $THREE. Sweep anything over 3 SOL to me on Fridays.">${esc(state.source)}</textarea>+ <div class="ap-egs" role="group" aria-label="Example policies">${EXAMPLES.map((e, i) => `<button class="ap-eg" type="button" data-eg="${i}" title="${esc(e)}" aria-label="Use example: ${esc(e)}">${esc(e.length > 54 ? e.slice(0, 52) + '…' : e)}</button>`).join('')}</div><div class="ap-fld"><label for="ap-sweep">Sweep destination (your wallet — required if you sweep profit)</label><input class="ap-in" id="ap-sweep" placeholder="Your Solana address" value="${esc(sweepDest)}" spellcheck="false" autocomplete="off" /></div><div class="ap-actions">- <button class="ap-btn primary" id="ap-compile">${state.compiling ? '<span class="ap-spin"></span>Compiling…' : 'Compile policy'}</button>- ${hasRules && !contradictions.length ? `<button class="ap-btn" id="ap-arm">Arm autopilot</button>` : ''}- ${state.policy?.rules?.length ? `<button class="ap-btn ghost" id="ap-cancel">Cancel</button>` : ''}+ <button class="ap-btn primary" id="ap-compile" type="button" ${state.compiling ? 'disabled aria-busy="true"' : ''}>${state.compiling ? '<span class="ap-spin" aria-hidden="true"></span>Compiling…' : 'Compile policy'}</button>+ ${hasRules && !contradictions.length ? `<button class="ap-btn" id="ap-arm" type="button">Arm autopilot</button>` : ''}+ ${state.policy?.rules?.length ? `<button class="ap-btn ghost" id="ap-cancel" type="button">Cancel</button>` : ''}</div>${preview}</div>`;diff --git a/src/agent-wallet-hub/tabs/balance.js b/src/agent-wallet-hub/tabs/balance.jsindex 6ec70a66d..34a61ab3c 100644--- a/src/agent-wallet-hub/tabs/balance.js+++ b/src/agent-wallet-hub/tabs/balance.js@@ -28,6 +28,9 @@ const BAL_STYLE = `/* .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-bal-refresh-icon { display: inline-block; }+.awh-bal-refresh-icon.is-spinning { animation: awh-bal-spin .7s linear infinite; }+@keyframes awh-bal-spin { to { transform: rotate(360deg); } }.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); }@@ -37,6 +40,7 @@ const BAL_STYLE = `.awh-act-delta { font-family: var(--font-mono, ui-monospace, monospace); flex: none; }.awh-act-delta.is-pos { color: var(--success,#4ade80); }.awh-act-delta.is-neg { color: var(--danger,#f87171); }+.awh-act-fail { display: inline-block; margin-right: 7px; font-size: var(--text-2xs,.6875rem); font-weight: 600; color: var(--danger,#f87171); border: 1px solid color-mix(in srgb, var(--danger,#f87171) 40%, transparent); border-radius: var(--radius-pill,999px); padding: 0 7px; vertical-align: middle; flex: none; }.awh-bal-skelbar, .awh-act-skel span { background: var(--surface-2, rgba(255,255,255,.05)); border-radius: var(--radius-sm,6px); animation: awh-skel 1.4s ease-in-out infinite; }.awh-bal-skelbar--lg { height: 28px; width: 42%; margin-bottom: 10px; }@@ -47,7 +51,7 @@ const BAL_STYLE = `.awh-act-skel span:nth-child(2) { width: 80%; }.awh-act-skel span:nth-child(3) { width: 88%; }@keyframes awh-skel { 0%,100% { opacity: .5; } 50% { opacity: 1; } }-@media (prefers-reduced-motion: reduce) { .awh-bal-skelbar, .awh-act-skel span { animation: none; } }+@media (prefers-reduced-motion: reduce) { .awh-bal-skelbar, .awh-act-skel span, .awh-bal-refresh-icon.is-spinning { animation: none; } }`;function injectBalanceStyle() {if (typeof document === 'undefined' || document.getElementById(BAL_STYLE_ID)) return;@@ -107,9 +111,9 @@ registerWalletTab({: '';panel.innerHTML = `- <div class="awh-card">+ <div class="awh-card" ${state.refreshing ? 'aria-busy="true"' : ''}><div class="awh-bal-top">- <div>+ <div role="status" aria-live="polite"><div class="awh-bal-amount ${balUnavailable ? 'is-unavailable' : ''}"${balUnavailable ? 'title="The Solana RPC could not be reached — this retries automatically."' : ''}>${escapeHtml(balText)}@@ -118,7 +122,8 @@ registerWalletTab({</div><button class="awh-btn awh-bal-refresh" type="button" data-act="refresh"${state.refreshing ? 'disabled' : ''} aria-label="Refresh balance">- ${state.refreshing ? 'Refreshing…' : '↻ Refresh'}+ <span class="awh-bal-refresh-icon ${state.refreshing ? 'is-spinning' : ''}" aria-hidden="true">↻</span>+ ${state.refreshing ? 'Refreshing…' : 'Refresh'}</button></div>${diff --git a/src/agent-wallet-hub/tabs/deposit.js b/src/agent-wallet-hub/tabs/deposit.jsindex 64f45a00f..a4e21e4f6 100644--- a/src/agent-wallet-hub/tabs/deposit.js+++ b/src/agent-wallet-hub/tabs/deposit.js@@ -318,9 +318,9 @@ registerWalletTab({</p></div>- <div class="awh-card" data-host="status">${statusBlock()}</div>+ <div class="awh-card" data-host="status" role="status" aria-live="polite">${statusBlock()}</div>- <div data-host="activity">${activityBlock(net)}</div>+ <div data-host="activity" aria-live="polite">${activityBlock(net)}</div>`;panel.querySelector('[data-act="copy"]')?.addEventListener('click', async () => {diff --git a/src/agent-wallet-hub/tabs/reputation.js b/src/agent-wallet-hub/tabs/reputation.jsindex 7eb51a7ce..63f755fdb 100644--- a/src/agent-wallet-hub/tabs/reputation.js+++ b/src/agent-wallet-hub/tabs/reputation.js@@ -21,50 +21,62 @@ import { registerWalletTab } from '../registry.js';import { reputationPanelEl, ensureReputationStyles } from '../../shared/agent-reputation.js';import { proofOfReservesPanelEl, ensureProofOfReservesStyles } from '../../shared/agent-proof-of-reserves.js';+const REP_STYLE_ID = 'awh-rep-style';+const REP_STYLE = `+.awh-rep-tab{display:flex;flex-direction:column;gap:var(--space-6,28px)}+.awh-rep-block{display:flex;flex-direction:column;gap:var(--space-3,12px)}+.awh-rep-h{margin:0;font-family:var(--font-display,Space Grotesk,sans-serif);font-size:var(--text-lg,1.0625rem);font-weight:700;color:var(--ink-bright,#fff);letter-spacing:-.01em}+.awh-rep-intro{margin:0;font-size:var(--text-sm,.8125rem);line-height:1.5;color:var(--ink-dim,#9ca3af);max-width:64ch}+`;++function injectRepStyle() {+ if (typeof document === 'undefined' || document.getElementById(REP_STYLE_ID)) return;+ const tag = document.createElement('style');+ tag.id = REP_STYLE_ID;+ tag.textContent = REP_STYLE;+ document.head.appendChild(tag);+}+registerWalletTab({id: 'reputation',label: 'Trust',order: 25, // between Pulse (15) and Deposit (20)… sorts after both; sits early.ownerOnly: false,mount({ panel, ctx }) {- ensureReputationStyles();+ // Inject wrapper styles first so the two shared panels never flash unstyled+ // before their own sheets and the layout settle.+ injectRepStyle();ensureProofOfReservesStyles();+ ensureReputationStyles();panel.innerHTML = '';+const wrap = document.createElement('div');wrap.className = 'awh-rep-tab';// "Open the books" — Proof-of-Reserves first (live, verifiable reserves +// lifetime flows + obligations), then the explainable financial-reputation// score it feeds. Both are public; the owner additionally sees guidance.- const reservesHead = document.createElement('div');+ // Each is its own labelled region so assistive tech can jump between the+ // two independent, self-loading panels.+ const reservesHead = document.createElement('section');reservesHead.className = 'awh-rep-block';+ reservesHead.setAttribute('aria-labelledby', 'awh-rep-reserves-h');reservesHead.innerHTML =- '<h3 class="awh-rep-h">Proof-of-Reserves</h3>' ++ '<h2 class="awh-rep-h" id="awh-rep-reserves-h">Proof-of-Reserves</h2>' +'<p class="awh-rep-intro">Live, independently verifiable holdings, lifetime flows, and what this wallet still owes — every figure traceable on-chain.</p>';reservesHead.appendChild(proofOfReservesPanelEl(ctx.agentId, { network: ctx.network }));wrap.appendChild(reservesHead);- const repHead = document.createElement('div');+ const repHead = document.createElement('section');repHead.className = 'awh-rep-block';+ repHead.setAttribute('aria-labelledby', 'awh-rep-score-h');repHead.innerHTML =- '<h3 class="awh-rep-h">Financial reputation</h3>' ++ '<h2 class="awh-rep-h" id="awh-rep-score-h">Financial reputation</h2>' +'<p class="awh-rep-intro">A real, non-gameable 0–100 credibility score from this wallet’s settlement reliability, generosity, longevity, trading conduct, and solvency. Fully explainable below.</p>';repHead.appendChild(reputationPanelEl(ctx.agentId, {}));wrap.appendChild(repHead);panel.appendChild(wrap);-- if (typeof document !== 'undefined' && !document.getElementById('awh-rep-style')) {- const tag = document.createElement('style');- tag.id = 'awh-rep-style';- tag.textContent = `-.awh-rep-tab{display:flex;flex-direction:column;gap:var(--space-6,28px)}-.awh-rep-block{display:flex;flex-direction:column;gap:var(--space-3,12px)}-.awh-rep-h{margin:0;font-family:var(--font-display,Space Grotesk,sans-serif);font-size:var(--text-lg,1.0625rem);font-weight:700;color:var(--ink-bright,#fff)}-.awh-rep-intro{margin:0;font-size:var(--text-sm,.8125rem);line-height:1.5;color:var(--ink-dim,#9ca3af)}-`;- document.head.appendChild(tag);- }return {};},});diff --git a/src/agent-wallet-hub/tabs/trade.js b/src/agent-wallet-hub/tabs/trade.jsindex aa37840cd..00b5022fe 100644--- a/src/agent-wallet-hub/tabs/trade.js+++ b/src/agent-wallet-hub/tabs/trade.js@@ -485,7 +485,7 @@ registerWalletTab({<div class="awh-tr-field"><div class="awh-tr-label">Quote</div>- <div data-host="quote">${quoteInnerHtml()}</div>+ <div data-host="quote" aria-live="polite" aria-atomic="true">${quoteInnerHtml()}</div></div><div data-host="safety" class="awh-tr-safety-host"></div>@@ -626,7 +626,7 @@ registerWalletTab({const ready = !!args && !!q && !state.quoting && !blocked;const sym = state.coin?.symbol || 'coin';if (state.submitting) {- return `<button class="awh-btn awh-btn--primary awh-tr-submit" type="button" disabled data-side="${state.side}">Submitting…</button>`;+ return `<button class="awh-btn awh-btn--primary awh-tr-submit" type="button" disabled aria-busy="true" data-side="${state.side}">Submitting…</button>`;}if (state.confirming && ready) {const q2 = state.quote;diff --git a/src/agent-wallet-hub/tabs/vanity.js b/src/agent-wallet-hub/tabs/vanity.jsindex ea0a83cb5..019b88329 100644--- a/src/agent-wallet-hub/tabs/vanity.js+++ b/src/agent-wallet-hub/tabs/vanity.js@@ -68,6 +68,16 @@ const VN_STYLE = `.awh-vn-paused{display:inline-block;margin-left:8px;font-size:var(--text-2xs,.625rem);font-weight:700;text-transform:uppercase;letter-spacing:.05em;color:var(--warn,#fbbf24);background:color-mix(in srgb,var(--warn,#fbbf24) 14%,transparent);border-radius:999px;padding:1px 7px;}.awh-vn-actions{display:flex;gap:8px;margin-top:var(--space-3,12px);}.awh-vn-actions .awh-btn{flex:1;}++@media (prefers-reduced-motion: reduce){+ .awh-vn-cores input[type=range]::-webkit-slider-thumb{transition:none;}+ .awh-vn-cores input[type=range]::-webkit-slider-thumb:hover{transform:none;}+ .awh-vn-ticks button{transition:none;}+}+@media (max-width: 400px){+ .awh-vn-prog-grid{gap:12px;}+ .awh-vn-actions{flex-wrap:wrap;}+}`;function injectStyle() {@@ -220,11 +230,11 @@ registerWalletTab({<div class="awh-vn-grid"><div class="awh-fld"><label for="awh-vn-prefix">Starts with</label>- <input class="awh-in awh-mono" id="awh-vn-prefix" autocomplete="off" spellcheck="false" maxlength="${MAX_PATTERN_LENGTH}" placeholder="e.g. ${esc(ph)}" value="${esc(state.prefix)}">+ <input class="awh-in awh-mono" id="awh-vn-prefix" autocomplete="off" autocapitalize="off" spellcheck="false" maxlength="${MAX_PATTERN_LENGTH}" aria-describedby="awh-vn-est" placeholder="e.g. ${esc(ph)}" value="${esc(state.prefix)}"></div><div class="awh-fld"><label for="awh-vn-suffix">Ends with</label>- <input class="awh-in awh-mono" id="awh-vn-suffix" autocomplete="off" spellcheck="false" maxlength="${MAX_PATTERN_LENGTH}" placeholder="optional" value="${esc(state.suffix)}">+ <input class="awh-in awh-mono" id="awh-vn-suffix" autocomplete="off" autocapitalize="off" spellcheck="false" maxlength="${MAX_PATTERN_LENGTH}" aria-describedby="awh-vn-est" placeholder="optional" value="${esc(state.suffix)}"></div></div>@@ -244,13 +254,13 @@ registerWalletTab({</div></div>- <div class="awh-vn-est ${est.warn ? 'warn' : ''}" id="awh-vn-est">${est.html}</div>+ <div class="awh-vn-est ${est.warn ? 'warn' : ''}" id="awh-vn-est" role="status" aria-live="polite">${est.html}</div>${isVanity || hasWallet? `<div class="awh-vn-warn">⚠ This replaces the agent's current address. Any SOL or tokens it holds are <b>automatically swept to the new address</b> first — the swap only completes once funds have moved. Apps pointed at the old address must be updated.</div>`: ''}- <div class="awh-err" id="awh-vn-err" hidden></div>+ <div class="awh-err" id="awh-vn-err" role="alert" hidden></div><button class="awh-btn awh-btn--primary" id="awh-vn-go" type="button" style="width:100%;">Grind & apply vanity address</button></div>`;}@@ -262,7 +272,7 @@ registerWalletTab({return `<div class="awh-card"><div class="awh-card-h" style="margin-bottom:2px;">Grinding <span class="awh-mono" style="color:#a78bfa;">${esc(state.prefix)}${state.prefix && state.suffix ? '…' : ''}${esc(state.suffix)}</span></div>- <div class="awh-vn-prog">+ <div class="awh-vn-prog" role="status" aria-live="polite" aria-label="Grind progress"><div class="awh-vn-prog-rate" id="awh-vn-rate">${applying ? '✦' : fmtRate(p.rate)}<span style="font-size:.9rem;font-weight:500;color:var(--ink-dim,#888);">${applying ? '' : ' /s'}</span><span class="awh-vn-paused" id="awh-vn-paused" ${paused ? '' : 'hidden'}>paused</span></div><div class="awh-vn-prog-sub">${applying ? 'Match found — migrating funds & applying…' : `across ${state.cores} core${state.cores > 1 ? 's' : ''}`}</div><div class="awh-vn-prog-grid">diff --git a/src/agent-wallet-hub/util.js b/src/agent-wallet-hub/util.jsindex 3a02ca2e4..9ca9dd6f1 100644--- a/src/agent-wallet-hub/util.js+++ b/src/agent-wallet-hub/util.js@@ -68,22 +68,30 @@ export function toast(message, ms = 2200) {}, ms);}-/** Format a SOL number for display. Returns "—" for nullish. */+/** Format a SOL number for display. Returns "—" for nullish/non-finite input. */export function formatSol(sol) {- if (sol == null || Number.isNaN(sol)) return '—';+ if (sol == null) return '—';+ const n = Number(sol);+ // Coerce first so non-numeric strings, NaN, and ±Infinity all degrade to "—"+ // instead of rendering the literal "NaN".+ if (!Number.isFinite(n)) return '—';// Trim to 4 dp but drop trailing zeros so "1.2000" reads "1.2".- const fixed = Number(sol).toFixed(4);+ const fixed = n.toFixed(4);return fixed.replace(/\.?0+$/, '') || '0';}/** Format a USD estimate. Returns null when no price/balance is available. */export function formatUsd(amount) {- if (amount == null || Number.isNaN(amount)) return null;+ if (amount == null) return null;+ const n = Number(amount);+ // A non-finite estimate is "no estimate" — return null so callers hide it+ // rather than printing "$NaN".+ if (!Number.isFinite(n)) return null;return new Intl.NumberFormat('en-US', {style: 'currency',currency: 'USD',- maximumFractionDigits: amount < 1 ? 4 : 2,- }).format(amount);+ maximumFractionDigits: Math.abs(n) < 1 ? 4 : 2,+ }).format(n);}/** Human "x ago" from a unix-seconds timestamp. */diff --git a/src/dashboard-next/pages/home.js b/src/dashboard-next/pages/home.jsindex 58d1a4b2c..b2c815fdd 100644--- a/src/dashboard-next/pages/home.js+++ b/src/dashboard-next/pages/home.js@@ -9,9 +9,14 @@ import { requireUser, get, esc, relTime, ApiError } from '../api.js';import { log } from '../../shared/log.js';import {cryptoOptionalBannerHTML,- cryptoOptionalTagHTML,injectStyles as injectCryptoOptionalStyles,} from '../../shared/crypto-optional.js';+import {+ emptyStateHTML,+ errorStateHTML,+ ensureStateKitStyles,+ attachRetry,+} from '../../shared/state-kit.js';const POLL_MS = 30_000;const DAYS_WINDOW = 7;@@ -163,14 +168,15 @@ const STATE = {})().catch((err) => {if (err?.message === 'redirecting') return;const main = document.querySelector('.dn-main-inner') || document.body;+ ensureStateKitStyles();main.innerHTML = `<h1 class="dn-h1">Overview</h1>- <div class="dn-panel" style="border-color:rgba(150,155,163,0.3)">- <div class="dn-panel-title" style="color:var(--nxt-danger)">Couldn't load this page</div>- <div class="dn-panel-sub">${(err && err.message ? err.message : 'unknown error').replace(/[<>&]/g, (c) => ({ '<':'<','>':'>','&':'&' }[c]))}</div>- <button class="dn-btn" onclick="location.reload()">Reload</button>- </div>+ ${errorStateHTML({+ title: "Couldn't load this page",+ body: esc(err && err.message ? err.message : 'Something interrupted the dashboard. Retry, or reload the page.'),+ })}`;+ attachRetry(main, () => location.reload());});// ── Skeletons ─────────────────────────────────────────────────────────────@@ -213,10 +219,23 @@ function renderSkeletons(main) {function renderHero(host, avatars, err) {if (err && !(err instanceof ApiError && err.status === 401)) {- host.innerHTML = `<div class="dn-panel" style="grid-column:1/-1">- <div class="dn-panel-title">Avatars</div>- <div style="color:var(--nxt-danger);font-size:13px">${esc(err.message || 'failed to load')}</div>- </div>`;+ ensureStateKitStyles();+ host.innerHTML = `<div class="dn-panel" style="grid-column:1/-1;padding:0">${errorStateHTML({+ title: "Couldn't load your avatars",+ body: esc(err.message || "The avatars service didn't respond. Check your connection and try again."),+ scope: 'avatars',+ })}</div>`;+ attachRetry(host, async () => {+ host.innerHTML = Array.from({ length: 3 }, () =>+ `<div class="dn-skeleton dnx-hero-card" style="min-height:280px"></div>`,+ ).join('');+ try {+ const res = await get('/api/avatars?limit=50');+ renderHero(host, res?.avatars ?? [], null);+ } catch (retryErr) {+ renderHero(host, [], retryErr);+ }+ });return;}