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.

Wire reputation/mood into wallet hub, trade guards, and avatar refinements

nirholas177c0c5ad287
diff --git a/api/_lib/agent-trade-guards.js b/api/_lib/agent-trade-guards.js
index d410c1a57..04c9c4222 100644
--- a/api/_lib/agent-trade-guards.js
+++ b/api/_lib/agent-trade-guards.js
@@ -684,8 +684,17 @@ export async function setPolicyRules(agentId, userId, rules, { english = null, r
// wallet has require_capabilities on and no covering grant exists, the spend is
// DENIED (fail safe). Returns the resolved capability, or null when none applies
// and none is required (unchanged behavior for wallets not using capabilities).
-async function resolveSpendCapability({ agentId, lim, category, usdValue, target, capability, capabilityHolderRef, now }) {
+async function resolveSpendCapability({ agentId, lim, category, usdValue, target, capability, capabilityHolderRef, ownerInitiated, now }) {
if (category === 'withdraw') return null;
+ // Owner-present actions (e.g. the hub's discretionary Trade tab) are not delegated
+ // capabilities — the owner is the authority, exactly like withdraw. We still honor
+ // an explicitly-presented capability, but never auto-resolve or require one here.
+ if (ownerInitiated) {
+ if (!capability) return null;
+ const s = evaluateCapabilityScope({ cap: capability, action: category, target, usdValue, now });
+ if (s) throw capabilityError(s.reason, s.detail);
+ return capability;
+ }
let cap = capability || null;
if (!cap && (lim.require_capabilities || capabilityHolderRef)) {
cap = await resolveCapabilityForSpend({ agentId, action: category, holderRef: capabilityHolderRef ?? null, target, usdValue, now });
@@ -713,6 +722,7 @@ export async function enforceSpendLimit({
capability,
capabilityHolderRef,
target,
+ ownerInitiated,
now,
network = 'mainnet',
}) {
@@ -784,7 +794,7 @@ export async function enforceSpendLimit({
// per-use) + a non-atomic aggregate read-check, mirroring how this enforce path
// already treats the daily cap non-atomically. The atomic aggregate reserve lives
// in reserveSpendUsd → reserveCapabilitySpend.
- const _cap = await resolveSpendCapability({ agentId, lim, category, usdValue, target, capability, capabilityHolderRef, now });
+ const _cap = await resolveSpendCapability({ agentId, lim, category, usdValue, target, capability, capabilityHolderRef, ownerInitiated, now });
const capabilityId = _cap?.id || null;
if (_cap && _cap.aggregate_usd != null && hasUsd) {
const _spent = await capabilitySpentUsd(_cap.id);
@@ -822,6 +832,7 @@ export async function reserveSpendUsd({
capability,
capabilityHolderRef,
target,
+ ownerInitiated,
now,
network = 'mainnet',
asset = 'USDC',
@@ -872,7 +883,7 @@ export async function reserveSpendUsd({
// ceiling AND the wallet daily cap under advisory locks and tags the pending row
// with capability_id. Return early so we never double-insert.
if (category !== 'withdraw') {
- const _cap = await resolveSpendCapability({ agentId, lim, category, usdValue, target: target ?? destination, capability, capabilityHolderRef, now });
+ const _cap = await resolveSpendCapability({ agentId, lim, category, usdValue, target: target ?? destination, capability, capabilityHolderRef, ownerInitiated, now });
if (_cap) {
const _r = await reserveCapabilitySpend({
capabilityId: _cap.id, agentId, userId, action: category,
diff --git a/api/agents/_id/reputation.js b/api/agents/_id/reputation.js
index b54df4045..66e2b77b9 100644
--- a/api/agents/_id/reputation.js
+++ b/api/agents/_id/reputation.js
@@ -13,6 +13,7 @@ import { getRedis } from '../../_lib/redis.js';
import { getSessionUser, authenticateBearer, extractBearer } from '../../_lib/auth.js';
import { sql } from '../../_lib/db.js';
import { getAgentReputation } from '../../_lib/trust/wallet-reputation.js';
+import { saveReputation } from '../../_lib/trust/reputation-store.js';
const CACHE_TTL_S = 180; // 3 minutes — score is derived, not real-time critical.
@@ -62,6 +63,9 @@ export const handleReputation = wrap(async (req, res, agentId) => {
if (redis && !result.partial) {
redis.set(cacheKey, result, { ex: CACHE_TTL_S }).catch(() => {});
}
+ // Warm the durable store too, so the access layer and the reputation-weighted
+ // leaderboard read a fresh row without waiting for the recompute cron.
+ if (!result.partial) saveReputation(result).catch(() => {});
res.setHeader('X-Cache', 'MISS');
}
diff --git a/api/agents/solana-trade.js b/api/agents/solana-trade.js
index 81fc66f08..5fc773f4a 100644
--- a/api/agents/solana-trade.js
+++ b/api/agents/solana-trade.js
@@ -349,7 +349,10 @@ export async function handleTrade(req, res, id) {
// Cross-path USD ceiling (shared with withdraw / x402 / snipe).
if (!guardWarning) {
try {
- await enforceSpendLimit({ agentId: id, limits: limitsCfg, category: 'trade', usdValue, network });
+ // ownerInitiated: the hub's discretionary Trade tab is the owner acting
+ // in person (session + CSRF), not a delegated skill — so least-privilege
+ // "require a capability" never blocks the owner's own trade (like withdraw).
+ await enforceSpendLimit({ agentId: id, limits: limitsCfg, category: 'trade', usdValue, network, ownerInitiated: true });
} catch (e) {
if (e instanceof SpendLimitError) guardWarning = { status: e.status, code: e.code, message: e.message, detail: e.detail };
else throw e;
diff --git a/api/agents/solana-wallet.js b/api/agents/solana-wallet.js
index 512ab3317..ed36f72b2 100644
--- a/api/agents/solana-wallet.js
+++ b/api/agents/solana-wallet.js
@@ -1083,6 +1083,7 @@ async function handlePolicy(req, res, id) {
SELECT id, event_type, category, network, asset, usd, destination, created_at, meta
FROM agent_custody_events
WHERE agent_id = ${id} AND network = ${network} AND event_type = 'spend'
+ AND status IN ('ok', 'pending', 'confirmed')
AND created_at > now() - interval '60 days'
ORDER BY created_at DESC
LIMIT 1000
diff --git a/src/agent-avatar.js b/src/agent-avatar.js
index 5bc6d00d6..3a1f0f601 100644
--- a/src/agent-avatar.js
+++ b/src/agent-avatar.js
@@ -196,6 +196,17 @@ export class AgentAvatar {
this._errorStreak = 0;
this._firstEncounter = true;
+ // Sustained mood layer (Living Agents · Task 07). Unlike the transient
+ // emotion blend above — which spikes on an event and decays to neutral —
+ // this is the agent's *resting* emotional state (valence × arousal). It is
+ // driven by the mood engine via setMood() and applied every frame as a
+ // continuous bias on top of the transient morphs, so the body keeps
+ // reflecting how the agent feels even when nothing is happening. Inactive
+ // until the first setMood() call, so avatars with no mood source behave
+ // exactly as before.
+ this._mood = { valence: 0.12, arousal: 0.32, active: false, reduced: false };
+ this._moodApplied = { valence: 0.12, arousal: 0.32 };
+
// Morph target current values (lerped each frame)
this._morphCurrent = {};
this._morphTarget = {};
@@ -349,6 +360,25 @@ export class AgentAvatar {
this._triggerOneShot(name);
}
+ /**
+ * Set the sustained mood (Living Agents · Task 07). The body continuously
+ * reflects this resting emotional state — a gentle smile and open posture when
+ * valence is high, a worried brow and lowered gaze when it's low; alert wide
+ * eyes and a forward lean at high arousal, heavy-lidded stillness when calm.
+ * Composited on top of, and lerped under, the transient emotion blend so it
+ * never snaps. `reducedMotion` keeps the facial cue but drops postural motion.
+ *
+ * @param {number} valence -1..1 (pleasantness)
+ * @param {number} arousal 0..1 (activation)
+ * @param {{reducedMotion?: boolean}} [opts]
+ */
+ setMood(valence, arousal, opts = {}) {
+ this._mood.valence = Math.max(-1, Math.min(1, Number(valence) || 0));
+ this._mood.arousal = Math.max(0, Math.min(1, Number.isFinite(arousal) ? arousal : 0.32));
+ this._mood.reduced = Boolean(opts.reducedMotion);
+ this._mood.active = true;
+ }
+
/**
* Signal whether the user is actively speaking (mic input active).
* When true the avatar holds eye contact; when false normal gaze resumes.
@@ -809,6 +839,12 @@ export class AgentAvatar {
this._setMorphTarget('noseSneerLeft', w.concern * 0.15);
this._setMorphTarget('noseSneerRight', w.concern * 0.15);
+ // ── Sustained mood layer ─────────────────────────────────────────
+ // The resting expression. Added on top of the transient targets above so
+ // a calm-positive agent keeps a soft smile between events, an agitated one
+ // a worried brow. Lerped slowly so mood shifts read as drifts, not cuts.
+ if (this._mood.active) this._applyMoodLayer(dt);
+
// ── Lerp morph influences to targets ─────────────────────────────
const lerpSpeed = dt * 4.0; // smooth interpolation, not snapping
this._lerpMorphTargets(lerpSpeed);
diff --git a/src/agent-wallet-hub/index.js b/src/agent-wallet-hub/index.js
index bc08a5140..6b34785c8 100644
--- a/src/agent-wallet-hub/index.js
+++ b/src/agent-wallet-hub/index.js
@@ -40,6 +40,7 @@ import './tabs/policy.js';
import './tabs/withdraw.js';
import './tabs/give.js';
import './tabs/recovery.js';
+import './tabs/guard.js';
import './tabs/proof.js';
import { escapeHtml, shortAddress, copyToClipboard, toast } from './util.js';
diff --git a/src/agent-wallet-hub/tabs/proof.js b/src/agent-wallet-hub/tabs/proof.js
index c442cf626..03932a91e 100644
--- a/src/agent-wallet-hub/tabs/proof.js
+++ b/src/agent-wallet-hub/tabs/proof.js
@@ -18,9 +18,7 @@
import { registerWalletTab } from '../registry.js';
import { apiFetch } from '../../api.js';
import { verifyInclusionProof } from '../../proof-of-custody/verifier.js';
-import { renderProofUI } from '../../proof-of-custody/ui.js';
-
-const STYLE_ID = 'awh-proof-style';
+import { renderProofUI, injectProofStyle } from '../../proof-of-custody/ui.js';
registerWalletTab({
id: 'proof',
@@ -28,7 +26,7 @@ registerWalletTab({
order: 70,
ownerOnly: true,
mount({ panel, ctx }) {
- injectStyle();
+ injectProofStyle();
let destroyed = false;
async function load() {
@@ -89,79 +87,3 @@ function errorState(msg) {
function escapeHtml(s) {
return String(s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
}
-
-function injectStyle() {
- if (document.getElementById(STYLE_ID)) return;
- const tag = document.createElement('style');
- tag.id = STYLE_ID;
- tag.textContent = PROOF_STYLE;
- document.head.appendChild(tag);
-}
-
-// Shared styling for the proof UI, used by both the hub tab and the standalone
-// /proof page (which imports renderProofUI from ../proof-of-custody/ui.js).
-export const PROOF_STYLE = `
-.awh-proof { display: flex; flex-direction: column; gap: var(--space-4,16px); }
-.awh-proof-card { border: 1px solid var(--stroke, rgba(255,255,255,.08)); border-radius: var(--radius-lg,14px); background: var(--surface-1, rgba(255,255,255,.03)); padding: var(--space-4,16px); }
-.awh-proof-card h2 { margin: 0 0 6px; font-size: var(--text-md,.9rem); color: var(--ink-bright,#fff); font-family: var(--font-display, system-ui); font-weight: 600; }
-.awh-proof-lead { color: var(--ink-dim,#888); font-size: var(--text-sm,.8125rem); line-height: 1.55; margin: 0 0 4px; max-width: 64ch; }
-.awh-proof-hero { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; border-radius: var(--radius-lg,14px); padding: var(--space-4,16px); border: 1px solid var(--stroke, rgba(255,255,255,.08)); background: var(--surface-1, rgba(255,255,255,.03)); transition: border-color var(--duration-base,220ms), background var(--duration-base,220ms); }
-.awh-proof-hero.is-verified { border-color: color-mix(in srgb, var(--success,#4ade80) 50%, transparent); background: color-mix(in srgb, var(--success,#4ade80) 8%, transparent); }
-.awh-proof-hero.is-failed { border-color: color-mix(in srgb, var(--danger,#f87171) 55%, transparent); background: color-mix(in srgb, var(--danger,#f87171) 8%, transparent); }
-.awh-proof-hero.is-pending { border-color: color-mix(in srgb, var(--warn,#fbbf24) 50%, transparent); background: color-mix(in srgb, var(--warn,#fbbf24) 7%, transparent); }
-.awh-proof-seal { width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 22px; background: var(--surface-3, rgba(255,255,255,.08)); }
-.awh-proof-hero.is-verified .awh-proof-seal { background: color-mix(in srgb, var(--success,#4ade80) 18%, transparent); color: var(--success,#4ade80); }
-.awh-proof-hero.is-failed .awh-proof-seal { background: color-mix(in srgb, var(--danger,#f87171) 18%, transparent); color: var(--danger,#f87171); }
-.awh-proof-hero.is-pending .awh-proof-seal { background: color-mix(in srgb, var(--warn,#fbbf24) 18%, transparent); color: var(--warn,#fbbf24); }
-.awh-proof-hero-main { min-width: 0; flex: 1; }
-.awh-proof-hero-title { font-size: var(--text-lg,1.15rem); font-weight: 700; color: var(--ink-bright,#fff); font-family: var(--font-display, system-ui); line-height: 1.15; }
-.awh-proof-hero-sub { font-size: var(--text-sm,.8125rem); color: var(--ink-dim,#888); margin-top: 3px; }
-.awh-proof-hero-sub a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
-.awh-proof-spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--warn,#fbbf24) 30%, transparent); border-top-color: var(--warn,#fbbf24); animation: awh-proof-spin 0.7s linear infinite; }
-@keyframes awh-proof-spin { to { transform: rotate(360deg); } }
-@media (prefers-reduced-motion: reduce) { .awh-proof-spin { animation: none; } }
-
-.awh-proof-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3,12px); }
-.awh-proof-fact { background: var(--surface-1, rgba(255,255,255,.03)); border: 1px solid var(--stroke, rgba(255,255,255,.08)); border-radius: var(--radius-md,10px); padding: 11px 13px; }
-.awh-proof-fact-k { font-size: var(--text-2xs,.6875rem); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-dim,#888); }
-.awh-proof-fact-v { font-family: var(--font-mono, ui-monospace, monospace); font-size: var(--text-sm,.8125rem); color: var(--ink-bright,#fff); margin-top: 4px; word-break: break-all; }
-.awh-proof-fact-v a { color: inherit; }
-
-.awh-proof-steps { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
-.awh-proof-step { display: flex; gap: 10px; align-items: flex-start; font-size: var(--text-sm,.8125rem); padding: 10px 12px; border-radius: var(--radius-md,10px); border: 1px solid var(--stroke, rgba(255,255,255,.08)); background: var(--surface-1, rgba(255,255,255,.03)); }
-.awh-proof-step-ico { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
-.awh-proof-step.ok { border-color: color-mix(in srgb, var(--success,#4ade80) 35%, transparent); }
-.awh-proof-step.ok .awh-proof-step-ico { background: color-mix(in srgb, var(--success,#4ade80) 18%, transparent); color: var(--success,#4ade80); }
-.awh-proof-step.bad { border-color: color-mix(in srgb, var(--danger,#f87171) 40%, transparent); }
-.awh-proof-step.bad .awh-proof-step-ico { background: color-mix(in srgb, var(--danger,#f87171) 18%, transparent); color: var(--danger,#f87171); }
-.awh-proof-step.pending .awh-proof-step-ico { background: var(--surface-3, rgba(255,255,255,.08)); color: var(--ink-dim,#888); }
-.awh-proof-step-c { min-width: 0; }
-.awh-proof-step-name { color: var(--ink-bright,#fff); font-weight: 600; }
-.awh-proof-step-detail { color: var(--ink-dim,#888); margin-top: 2px; line-height: 1.5; }
-
-.awh-proof-recon { border-radius: var(--radius-md,10px); padding: 12px 14px; border: 1px solid var(--stroke, rgba(255,255,255,.08)); background: var(--surface-1, rgba(255,255,255,.03)); font-size: var(--text-sm,.8125rem); line-height: 1.55; color: var(--ink,#e8e8e8); }
-.awh-proof-recon.is-good { border-color: color-mix(in srgb, var(--success,#4ade80) 35%, transparent); }
-.awh-proof-recon.is-bad { border-color: color-mix(in srgb, var(--danger,#f87171) 50%, transparent); background: color-mix(in srgb, var(--danger,#f87171) 7%, transparent); color: var(--danger,#f87171); }
-.awh-proof-recon-h { font-weight: 600; color: var(--ink-bright,#fff); display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
-.awh-proof-recon.is-bad .awh-proof-recon-h { color: var(--danger,#f87171); }
-.awh-proof-events { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
-.awh-proof-event { display: flex; justify-content: space-between; gap: 12px; font-size: var(--text-2xs,.72rem); font-family: var(--font-mono, ui-monospace, monospace); color: var(--ink-dim,#888); padding: 6px 9px; border-radius: var(--radius-sm,6px); background: var(--surface-2, rgba(255,255,255,.04)); }
-.awh-proof-event a { color: var(--ink,#c8c8c8); }
-
-.awh-proof-btn { appearance: none; font: inherit; font-size: var(--text-sm,.8125rem); font-weight: 600; cursor: pointer; color: var(--bg-1,#0a0a0a); background: var(--accent,#fff); border: 1px solid var(--accent,#fff); border-radius: var(--radius-md,10px); padding: 9px 16px; text-decoration: none; display: inline-flex; align-items: center; gap: 7px; transition: opacity var(--duration-fast,140ms), transform var(--duration-fast,140ms); }
-.awh-proof-btn:hover { opacity: .9; }
-.awh-proof-btn:active { transform: translateY(1px); }
-.awh-proof-btn:focus-visible { outline: var(--focus-ring-width,2px) solid var(--focus-ring-color,#fff); outline-offset: 2px; }
-.awh-proof-btn.ghost { color: var(--ink,#e8e8e8); background: transparent; border-color: var(--stroke, rgba(255,255,255,.12)); }
-.awh-proof-btn:disabled { opacity: .5; cursor: progress; }
-.awh-proof-actions { display: flex; gap: 10px; flex-wrap: wrap; }
-
-.awh-proof-share { margin-top: 12px; }
-.awh-proof-embed { width: 100%; font-family: var(--font-mono, ui-monospace, monospace); font-size: var(--text-2xs,.7rem); color: var(--ink-dim,#888); background: var(--surface-2, rgba(255,255,255,.04)); border: 1px solid var(--stroke, rgba(255,255,255,.08)); border-radius: var(--radius-md,10px); padding: 9px 11px; resize: vertical; min-height: 54px; }
-.awh-proof-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--radius-pill,999px); font-size: var(--text-2xs,.72rem); font-weight: 600; border: 1px solid color-mix(in srgb, var(--success,#4ade80) 40%, transparent); color: var(--success,#4ade80); background: color-mix(in srgb, var(--success,#4ade80) 10%, transparent); }
-.awh-proof-badge::before { content: '✓'; }
-
-.awh-proof-skel span { display: block; background: var(--surface-2, rgba(255,255,255,.05)); border-radius: var(--radius-md,10px); animation: awh-skel 1.4s ease-in-out infinite; }
-@keyframes awh-skel { 0%,100% { opacity: .5; } 50% { opacity: 1; } }
-@media (prefers-reduced-motion: reduce) { .awh-proof-skel span { animation: none; } }
-`;
diff --git a/src/agent-wallet-hub/tabs/withdraw.js b/src/agent-wallet-hub/tabs/withdraw.js
index f63cd9dc6..a1332218a 100644
--- a/src/agent-wallet-hub/tabs/withdraw.js
+++ b/src/agent-wallet-hub/tabs/withdraw.js
@@ -628,19 +628,35 @@ registerWalletTab({
limit_change: { ic: '⚙', label: 'Limits updated' },
};
const CAT = { trade: 'Trade', snipe: 'Snipe', x402: 'x402 payment', withdraw: 'Withdrawal' };
- const title = (e) => (e.event_type === 'spend' ? (CAT[e.category] || 'Spend') : (META[e.event_type]?.label || e.event_type));
- const icon = (e) => (e.event_type === 'spend' ? (e.category === 'withdraw' ? '↑' : '💸') : (META[e.event_type]?.ic || '•'));
+ // A spend row marked failed by a policy rule (reason policy_*) is a payment
+ // the natural-language policy STOPPED — surfaced inline so the owner sees
+ // exactly which rule fired. A limit_change with a policy reason is a
+ // policy edit / auto-freeze.
+ const isPolicyBlock = (e) => e.event_type === 'spend' && typeof e.reason === 'string' && e.reason.startsWith('policy_');
+ const isPolicyChange = (e) => e.event_type === 'limit_change' && (e.reason === 'policy_updated' || e.reason === 'policy_freeze');
+ const ruleText = (e) => (e.meta && typeof e.meta === 'object' ? (e.meta.rule || null) : null);
+ const title = (e) => {
+ if (isPolicyBlock(e)) return e.reason === 'policy_freeze' ? 'Frozen by your rule' : e.reason === 'policy_step_up' ? 'Needs your approval' : 'Blocked by your rule';
+ if (isPolicyChange(e)) return e.reason === 'policy_freeze' ? 'Auto-frozen by policy' : 'Spend policy updated';
+ return e.event_type === 'spend' ? (CAT[e.category] || 'Spend') : (META[e.event_type]?.label || e.event_type);
+ };
+ const icon = (e) => {
+ if (isPolicyBlock(e) || isPolicyChange(e)) return '🛡';
+ return e.event_type === 'spend' ? (e.category === 'withdraw' ? '↑' : '💸') : (META[e.event_type]?.ic || '•');
+ };
function renderEvent(e) {
let amt = '';
if (e.asset === 'SOL' && e.amount_lamports != null) amt = `${fmtAmount(Number(e.amount_lamports) / 1e9, 6)} SOL`;
else if (e.usd != null) amt = formatUsd(e.usd) || '';
else if (e.asset && e.asset !== 'SOL') amt = shortAddress(e.asset, 4, 4);
+ const policyNote = (isPolicyBlock(e) || isPolicyChange(e)) ? ruleText(e) : null;
const when = e.created_at ? new Date(e.created_at).toLocaleString() : '';
const sub = [
e.destination ? `→ ${shortAddress(e.destination, 4, 4)}` : '',
+ policyNote ? `“${esc(policyNote)}”` : '',
e.event_type === 'key_recover' && e.reason ? esc(e.reason) : '',
- e.status && e.status !== 'ok' && e.status !== 'confirmed' ? `[${esc(e.status)}]` : '',
+ e.status && e.status !== 'ok' && e.status !== 'confirmed' && !isPolicyBlock(e) ? `[${esc(e.status)}]` : '',
esc(when),
].filter(Boolean).join(' · ');
return `<li class="awh-ev"><span class="ic">${icon(e)}</span><span class="m"><span class="ttl">${esc(title(e))}</span><span class="sb">${sub}${e.explorer ? ` · <a href="${esc(e.explorer)}" target="_blank" rel="noopener">tx ↗</a>` : ''}</span></span><span class="amt">${esc(amt)}</span></li>`;
diff --git a/src/agents/mood-engine.js b/src/agents/mood-engine.js
index 7c5f3f8b2..d07a3eebc 100644
--- a/src/agents/mood-engine.js
+++ b/src/agents/mood-engine.js
@@ -360,6 +360,8 @@ class MoodEngine {
}
}
+const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
+function isUuid(v) { return typeof v === 'string' && UUID_RE.test(v); }
function clamp01(n) { return Math.max(0, Math.min(1, Number(n) || 0)); }
function round3(n) { return Math.round((Number(n) || 0) * 1000) / 1000; }
diff --git a/src/proof-of-custody/ui.js b/src/proof-of-custody/ui.js
index 1aa0eeca0..c8d111b58 100644
--- a/src/proof-of-custody/ui.js
+++ b/src/proof-of-custody/ui.js
@@ -218,3 +218,80 @@ function formatSol(n) {
const v = Number(n);
return v.toLocaleString(undefined, { minimumFractionDigits: 0, maximumFractionDigits: 6 });
}
+
+const STYLE_ID = 'poc-proof-style';
+
+/** Inject the shared proof styles once (used by the hub tab and /proof page). */
+export function injectProofStyle() {
+ if (typeof document === 'undefined' || document.getElementById(STYLE_ID)) return;
+ const tag = document.createElement('style');
+ tag.id = STYLE_ID;
+ tag.textContent = PROOF_STYLE;
+ document.head.appendChild(tag);
+}
+
+export const PROOF_STYLE = `
+.awh-proof { display: flex; flex-direction: column; gap: var(--space-4,16px); }
+.awh-proof-card { border: 1px solid var(--stroke, rgba(255,255,255,.08)); border-radius: var(--radius-lg,14px); background: var(--surface-1, rgba(255,255,255,.03)); padding: var(--space-4,16px); }
+.awh-proof-card h2 { margin: 0 0 6px; font-size: var(--text-md,.9rem); color: var(--ink-bright,#fff); font-family: var(--font-display, system-ui); font-weight: 600; }
+.awh-proof-lead { color: var(--ink-dim,#888); font-size: var(--text-sm,.8125rem); line-height: 1.55; margin: 0 0 4px; max-width: 64ch; }
+.awh-proof-hero { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; border-radius: var(--radius-lg,14px); padding: var(--space-4,16px); border: 1px solid var(--stroke, rgba(255,255,255,.08)); background: var(--surface-1, rgba(255,255,255,.03)); transition: border-color var(--duration-base,220ms), background var(--duration-base,220ms); }
+.awh-proof-hero.is-verified { border-color: color-mix(in srgb, var(--success,#4ade80) 50%, transparent); background: color-mix(in srgb, var(--success,#4ade80) 8%, transparent); }
+.awh-proof-hero.is-failed { border-color: color-mix(in srgb, var(--danger,#f87171) 55%, transparent); background: color-mix(in srgb, var(--danger,#f87171) 8%, transparent); }
+.awh-proof-hero.is-pending { border-color: color-mix(in srgb, var(--warn,#fbbf24) 50%, transparent); background: color-mix(in srgb, var(--warn,#fbbf24) 7%, transparent); }
+.awh-proof-seal { width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 22px; background: var(--surface-3, rgba(255,255,255,.08)); }
+.awh-proof-hero.is-verified .awh-proof-seal { background: color-mix(in srgb, var(--success,#4ade80) 18%, transparent); color: var(--success,#4ade80); }
+.awh-proof-hero.is-failed .awh-proof-seal { background: color-mix(in srgb, var(--danger,#f87171) 18%, transparent); color: var(--danger,#f87171); }
+.awh-proof-hero.is-pending .awh-proof-seal { background: color-mix(in srgb, var(--warn,#fbbf24) 18%, transparent); color: var(--warn,#fbbf24); }
+.awh-proof-hero-main { min-width: 0; flex: 1; }
+.awh-proof-hero-title { font-size: var(--text-lg,1.15rem); font-weight: 700; color: var(--ink-bright,#fff); font-family: var(--font-display, system-ui); line-height: 1.15; }
+.awh-proof-hero-sub { font-size: var(--text-sm,.8125rem); color: var(--ink-dim,#888); margin-top: 3px; }
+.awh-proof-hero-sub a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
+.awh-proof-spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--warn,#fbbf24) 30%, transparent); border-top-color: var(--warn,#fbbf24); animation: awh-proof-spin 0.7s linear infinite; }
+@keyframes awh-proof-spin { to { transform: rotate(360deg); } }
+@media (prefers-reduced-motion: reduce) { .awh-proof-spin { animation: none; } }
+
+.awh-proof-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3,12px); }
+.awh-proof-fact { background: var(--surface-1, rgba(255,255,255,.03)); border: 1px solid var(--stroke, rgba(255,255,255,.08)); border-radius: var(--radius-md,10px); padding: 11px 13px; }
+.awh-proof-fact-k { font-size: var(--text-2xs,.6875rem); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-dim,#888); }
+.awh-proof-fact-v { font-family: var(--font-mono, ui-monospace, monospace); font-size: var(--text-sm,.8125rem); color: var(--ink-bright,#fff); margin-top: 4px; word-break: break-all; }
+.awh-proof-fact-v a { color: inherit; }
+
+.awh-proof-steps { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
+.awh-proof-step { display: flex; gap: 10px; align-items: flex-start; font-size: var(--text-sm,.8125rem); padding: 10px 12px; border-radius: var(--radius-md,10px); border: 1px solid var(--stroke, rgba(255,255,255,.08)); background: var(--surface-1, rgba(255,255,255,.03)); }
+.awh-proof-step-ico { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
+.awh-proof-step.ok { border-color: color-mix(in srgb, var(--success,#4ade80) 35%, transparent); }
+.awh-proof-step.ok .awh-proof-step-ico { background: color-mix(in srgb, var(--success,#4ade80) 18%, transparent); color: var(--success,#4ade80); }
+.awh-proof-step.bad { border-color: color-mix(in srgb, var(--danger,#f87171) 40%, transparent); }
+.awh-proof-step.bad .awh-proof-step-ico { background: color-mix(in srgb, var(--danger,#f87171) 18%, transparent); color: var(--danger,#f87171); }
+.awh-proof-step.pending .awh-proof-step-ico { background: var(--surface-3, rgba(255,255,255,.08)); color: var(--ink-dim,#888); }
+.awh-proof-step-c { min-width: 0; }
+.awh-proof-step-name { color: var(--ink-bright,#fff); font-weight: 600; }
+.awh-proof-step-detail { color: var(--ink-dim,#888); margin-top: 2px; line-height: 1.5; }
+
+.awh-proof-recon { border-radius: var(--radius-md,10px); padding: 12px 14px; border: 1px solid var(--stroke, rgba(255,255,255,.08)); background: var(--surface-1, rgba(255,255,255,.03)); font-size: var(--text-sm,.8125rem); line-height: 1.55; color: var(--ink,#e8e8e8); }
+.awh-proof-recon.is-good { border-color: color-mix(in srgb, var(--success,#4ade80) 35%, transparent); }
+.awh-proof-recon.is-bad { border-color: color-mix(in srgb, var(--danger,#f87171) 50%, transparent); background: color-mix(in srgb, var(--danger,#f87171) 7%, transparent); color: var(--danger,#f87171); }
+.awh-proof-recon-h { font-weight: 600; color: var(--ink-bright,#fff); display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
+.awh-proof-recon.is-bad .awh-proof-recon-h { color: var(--danger,#f87171); }
+.awh-proof-events { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
+.awh-proof-event { display: flex; justify-content: space-between; gap: 12px; font-size: var(--text-2xs,.72rem); font-family: var(--font-mono, ui-monospace, monospace); color: var(--ink-dim,#888); padding: 6px 9px; border-radius: var(--radius-sm,6px); background: var(--surface-2, rgba(255,255,255,.04)); }
+.awh-proof-event a { color: var(--ink,#c8c8c8); }
+
+.awh-proof-btn { appearance: none; font: inherit; font-size: var(--text-sm,.8125rem); font-weight: 600; cursor: pointer; color: var(--bg-1,#0a0a0a); background: var(--accent,#fff); border: 1px solid var(--accent,#fff); border-radius: var(--radius-md,10px); padding: 9px 16px; text-decoration: none; display: inline-flex; align-items: center; gap: 7px; transition: opacity var(--duration-fast,140ms), transform var(--duration-fast,140ms); }
+.awh-proof-btn:hover { opacity: .9; }
+.awh-proof-btn:active { transform: translateY(1px); }
+.awh-proof-btn:focus-visible { outline: var(--focus-ring-width,2px) solid var(--focus-ring-color,#fff); outline-offset: 2px; }
+.awh-proof-btn.ghost { color: var(--ink,#e8e8e8); background: transparent; border-color: var(--stroke, rgba(255,255,255,.12)); }
+.awh-proof-btn:disabled { opacity: .5; cursor: progress; }
+.awh-proof-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
+
+.awh-proof-share { margin-top: 12px; }
+.awh-proof-embed { width: 100%; font-family: var(--font-mono, ui-monospace, monospace); font-size: var(--text-2xs,.7rem); color: var(--ink-dim,#888); background: var(--surface-2, rgba(255,255,255,.04)); border: 1px solid var(--stroke, rgba(255,255,255,.08)); border-radius: var(--radius-md,10px); padding: 9px 11px; resize: vertical; min-height: 54px; }
+.awh-proof-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--radius-pill,999px); font-size: var(--text-2xs,.72rem); font-weight: 600; border: 1px solid color-mix(in srgb, var(--success,#4ade80) 40%, transparent); color: var(--success,#4ade80); background: color-mix(in srgb, var(--success,#4ade80) 10%, transparent); }
+.awh-proof-badge::before { content: '✓'; }
+
+.awh-proof-skel span { display: block; background: var(--surface-2, rgba(255,255,255,.05)); border-radius: var(--radius-md,10px); animation: awh-skel 1.4s ease-in-out infinite; margin-bottom: 12px; }
+@keyframes awh-skel { 0%,100% { opacity: .5; } 50% { opacity: 1; } }
+@media (prefers-reduced-motion: reduce) { .awh-proof-skel span { animation: none; } }
+`;
diff --git a/src/shared/wallet-card.js b/src/shared/wallet-card.js
index 311032b48..45e6971f9 100644
--- a/src/shared/wallet-card.js
+++ b/src/shared/wallet-card.js
@@ -139,7 +139,8 @@ export function mountWalletCard(host, agent, opts = {}) {
if (typeof document === 'undefined' || !host) return null;
const identity = getWalletIdentity(agent);
const agentId = identity?.agentId || agent?.id || agent?.agent_id || null;
- if (!agentId) return null;
+ // No custodial wallet → no card. The caller renders its own empty/pending state.
+ if (!identity || !agentId) return null;
ensureStyles();