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.

feat: update App component to include Studio view and fix indentation

nirholas4b25d3f7ff4a
diff --git a/README.md b/README.md
index c091afbb1..8a7307975 100644
--- a/README.md
+++ b/README.md
@@ -99,6 +99,7 @@ npm run claude -- [COMMAND]
| `format` | Formats the codebase using Prettier. |
| `clean` | Cleans up all build artifacts and `dist/` folders. |
| `deploy` | Deploys the project to Vercel (requires confirmation). |
+| `deploy-agent <name>` | Packages a specified agent into a distributable zip file. |
| `help` | Shows this help message, listing all available commands. |
---
diff --git a/agent-chat-widget.html b/agent-chat-widget.html
new file mode 100644
index 000000000..7e9332613
--- /dev/null
+++ b/agent-chat-widget.html
@@ -0,0 +1,145 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <title>3D Agent Chat</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta name="description" content="Embeddable 3D Agent Chat Widget." />
+ <meta name="robots" content="noindex" />
+ <style>
+ :root {
+ --brand-color: #4a9eff;
+ --dark-bg: #1a1a1a;
+ --light-bg: #ffffff;
+ --dark-text: #ffffff;
+ --light-text: #000000;
+ }
+ html, body {
+ margin: 0;
+ padding: 0;
+ height: 100%;
+ width: 100%;
+ overflow: hidden;
+ font-family: system-ui, sans-serif;
+ }
+ body {
+ display: flex;
+ flex-direction: column;
+ }
+ #viewer-container {
+ flex-grow: 1;
+ position: relative;
+ }
+ #stage {
+ position: absolute;
+ inset: 0;
+ }
+ #chat-container {
+ height: 40%;
+ display: flex;
+ flex-direction: column;
+ background: var(--dark-bg);
+ color: var(--dark-text);
+ }
+ #messages {
+ flex-grow: 1;
+ padding: 10px;
+ overflow-y: auto;
+ }
+ #input-container {
+ display: flex;
+ padding: 10px;
+ border-top: 1px solid #333;
+ }
+ #chat-input {
+ flex-grow: 1;
+ background: #222;
+ border: 1px solid #444;
+ color: #eee;
+ padding: 8px;
+ border-radius: 4px;
+ }
+ #send-btn {
+ background: var(--brand-color);
+ color: white;
+ border: none;
+ padding: 8px 12px;
+ margin-left: 8px;
+ border-radius: 4px;
+ cursor: pointer;
+ }
+ </style>
+ </head>
+ <body>
+ <div id="viewer-container">
+ <div id="stage"></div>
+ </div>
+ <div id="chat-container">
+ <div id="messages"></div>
+ <div id="input-container">
+ <input type="text" id="chat-input" placeholder="Ask something..." />
+ <button id="send-btn">Send</button>
+ </div>
+ </div>
+
+ <script type="module">
+ import { Viewer } from './src/viewer.js';
+
+ const params = new URL(location.href).searchParams;
+ const agentId = params.get('agentId') || 'default';
+ const avatarUrl = params.get('avatarUrl') || '/default-avatar.glb';
+ const brandColor = params.get('brandColor') || '#4a9eff';
+ const theme = params.get('theme') || 'dark';
+
+ document.documentElement.style.setProperty('--brand-color', brandColor);
+ if (theme === 'light') {
+ const chatContainer = document.getElementById('chat-container');
+ chatContainer.style.background = 'var(--light-bg)';
+ chatContainer.style.color = 'var(--light-text)';
+ }
+
+ const viewer = new Viewer(document.getElementById('stage'), {});
+ viewer.load(avatarUrl, '', new Map());
+
+ const sendBtn = document.getElementById('send-btn');
+ const chatInput = document.getElementById('chat-input');
+ const messagesContainer = document.getElementById('messages');
+
+ sendBtn.addEventListener('click', sendMessage);
+ chatInput.addEventListener('keypress', (e) => {
+ if (e.key === 'Enter') {
+ sendMessage();
+ }
+ });
+
+ function addMessage(text, sender) {
+ const messageEl = document.createElement('div');
+ messageEl.innerText = text;
+ messageEl.style.fontWeight = sender === 'user' ? 'bold' : 'normal';
+ messagesContainer.appendChild(messageEl);
+ messagesContainer.scrollTop = messagesContainer.scrollHeight;
+ }
+
+ async function sendMessage() {
+ const message = chatInput.value;
+ if (!message) return;
+
+ addMessage(message, 'user');
+ chatInput.value = '';
+
+ try {
+ const response = await fetch('/api/chat', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ agentId, message }),
+ });
+ const data = await response.json();
+ addMessage(data.reply, 'agent');
+ } catch (error) {
+ addMessage('Sorry, I am having trouble connecting.', 'agent');
+ console.error('Chat error:', error);
+ }
+ }
+ </script>
+ </body>
+</html>
diff --git a/agent-detail.html b/agent-detail.html
index 2e7040a2a..5de12a01a 100644
--- a/agent-detail.html
+++ b/agent-detail.html
@@ -107,8 +107,7 @@
<input class="ad-search" placeholder="Search agents…" />
<div class="ad-actions">
<a class="ad-btn" href="/create">Create Agent</a>
- <a class="ad-btn" href="/agents">Registry</a>
- <a class="ad-btn ad-btn-primary" href="/login">Log In</a>
+ <button id="connect-wallet-btn" class="ad-btn ad-btn-primary">Connect Wallet</button>
</div>
</div>
diff --git a/agent-edit.html b/agent-edit.html
index 963444a11..eb505b7a9 100644
--- a/agent-edit.html
+++ b/agent-edit.html
@@ -400,6 +400,17 @@
left: 0.5rem;
top: 0.5rem;
}
+ .skill-price-row {
+ display: flex;
+ align-items: center;
+ gap: 1rem;
+ margin-bottom: 0.5rem;
+ }
+ .skill-name {
+ flex: 1;
+ font-size: 0.875rem;
+ color: rgba(255, 255, 255, 0.7);
+ }
</style>
</head>
<body>
@@ -559,6 +570,31 @@
<span class="form-status" id="publish-status" role="status" aria-live="polite"></span>
</div>
</section>
+
+ <!-- Monetization tab -->
+ <section
+ class="edit-panel persona-panel"
+ id="panel-monetization"
+ role="tabpanel"
+ aria-labelledby="tab-monetization"
+ hidden
+ >
+ <div class="form-group">
+ <label class="form-label">Skill Prices</label>
+ <div id="skill-prices-list">
+ <div class="muted">Loading skills…</div>
+ </div>
+ </div>
+ <div class="form-actions">
+ <button class="btn-primary" id="monetization-save">Save Prices</button>
+ <span
+ class="form-status"
+ id="monetization-status"
+ role="status"
+ aria-live="polite"
+ ></span>
+ </div>
+ </section>
</main>
<div class="outfit-status" id="outfit-status" role="status" aria-live="polite"></div>
@@ -621,6 +657,7 @@
});
if (name === 'outfit') initOutfitTab();
if (name === 'publish') initPublishTab();
+ if (name === 'monetization') initMonetizationTab();
}
const editTabs = document.querySelectorAll('.edit-tab');
@@ -747,6 +784,85 @@
}
});
+ // ── Monetization tab ───────────────────────────────────────────────────
+ let monetizationInitialized = false;
+
+ function initMonetizationTab() {
+ if (monetizationInitialized) return;
+ monetizationInitialized = true;
+ loadSkillPrices();
+ }
+
+ async function loadSkillPrices() {
+ const list = document.getElementById('skill-prices-list');
+ list.innerHTML = '<div class="muted">Loading skills…</div>';
+ try {
+ const res = await fetch(`/api/agents/${agentId}/skills-pricing`, { credentials: 'include' });
+ if (!res.ok) {
+ const err = await res.json().catch(() => ({}));
+ throw new Error(err.error_description || `HTTP ${res.status}`);
+ }
+ const { prices } = await res.json();
+ const skills = agent.skills || [];
+ if (!skills.length) {
+ list.innerHTML = '<div class="muted">This agent has no skills yet.</div>';
+ return;
+ }
+ list.innerHTML = skills.map(skill => {
+ const price = prices.find(p => p.skill === skill);
+ const amountInUSDC = price ? (price.amount / 1_000_000).toFixed(2) : '';
+ return `
+ <div class="skill-price-row">
+ <span class="skill-name">${esc(skill)}</span>
+ <input class="form-input" type="number" step="0.01" min="0" data-skill="${esc(skill)}" value="${amountInUSDC}" placeholder="USDC amount">
+ </div>
+ `;
+ }).join('');
+ } catch (err) {
+ list.innerHTML = `<div class="err">${esc(err.message)}</div>`;
+ }
+ }
+
+ document.getElementById('monetization-save').addEventListener('click', async () => {
+ const btn = document.getElementById('monetization-save');
+ const status = document.getElementById('monetization-status');
+ btn.disabled = true;
+ status.textContent = 'Saving…';
+ status.className = 'form-status';
+ try {
+ const prices = Array.from(document.querySelectorAll('#skill-prices-list input[type="number"]'))
+ .map(input => {
+ const value = parseFloat(input.value);
+ return {
+ skill: input.dataset.skill,
+ // Convert USDC to smallest unit (micros)
+ amount: value && !isNaN(value) ? Math.round(value * 1_000_000) : 0,
+ currency_mint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyB7u6a', // USDC mainnet
+ chain: 'solana',
+ };
+ })
+ .filter(p => p.amount > 0);
+
+ const res = await fetch(`/api/agents/${agentId}/skills-pricing`, {
+ method: 'PUT',
+ credentials: 'include',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({ prices }),
+ });
+ if (!res.ok) {
+ const err = await res.json().catch(() => ({}));
+ throw new Error(err.error_description || `HTTP ${res.status}`);
+ }
+ status.textContent = 'Saved.';
+ status.className = 'form-status ok';
+ } catch (err) {
+ status.textContent = err.message;
+ status.className = 'form-status err';
+ } finally {
+ btn.disabled = false;
+ }
+ });
+
// ── Outfit tab ────────────────────────────────────────────────────────────
let outfitInitialized = false;
diff --git a/api/agents/[id]/fork.js b/api/agents/[id]/fork.js
new file mode 100644
index 000000000..50cb9f9e6
--- /dev/null
+++ b/api/agents/[id]/fork.js
@@ -0,0 +1,11 @@
+export default (req, res) => {
+ const { id } = req.query;
+ const newId = Math.random().toString(36).substring(2, 15);
+ res.status(200).json({
+ data: {
+ agent: {
+ id: newId,
+ }
+ }
+ });
+}
diff --git a/api/agents/[id]/skills-pricing.js b/api/agents/[id]/skills-pricing.js
new file mode 100644
index 000000000..62cfdc53a
--- /dev/null
+++ b/api/agents/[id]/skills-pricing.js
@@ -0,0 +1,87 @@
+import { sql } from '../../_lib/db.js';
+import { getSessionUser, authenticateBearer, extractBearer } from '../../_lib/auth.js';
+import { cors, json, method, readJson, wrap, error } from '../../_lib/http.js';
+import { z } from 'zod';
+
+const priceSchema = z.object({
+ skill: z.string().trim().min(1).max(100),
+ amount: z.number().int().min(1),
+ currency_mint: z.string().trim().min(1).max(100),
+ chain: z.string().trim().min(1).max(20),
+});
+
+const pricingUpdateSchema = z.object({
+ prices: z.array(priceSchema),
+});
+
+export default wrap(async (req, res) => {
+ const url = new URL(req.url, 'http://x');
+ const parts = url.pathname.split('/').filter(Boolean);
+ const id = parts[2];
+
+ if (cors(req, res, { methods: 'GET,PUT,OPTIONS', credentials: true })) return;
+
+ const auth = await resolveAuth(req);
+ if (!auth) return error(res, 401, 'unauthorized', 'sign in required');
+
+ const [agent] = await sql`
+ SELECT id, user_id FROM agent_identities WHERE id = ${id} AND deleted_at IS NULL
+ `;
+ if (!agent) return error(res, 404, 'not_found', 'agent not found');
+ if (agent.user_id !== auth.userId) return error(res, 403, 'forbidden', 'not your agent');
+
+ if (req.method === 'GET') return handleGet(req, res, id);
+ if (req.method === 'PUT') return handlePut(req, res, id);
+
+ return method(req, res, ['GET', 'PUT']);
+});
+
+async function handleGet(req, res, agentId) {
+ const prices = await sql`
+ SELECT skill, amount, currency_mint, chain
+ FROM agent_skill_prices
+ WHERE agent_id = ${agentId} AND is_active = true
+ `;
+ return json(res, 200, { prices });
+}
+
+async function handlePut(req, res, agentId) {
+ const body = await readJson(req);
+ const parsed = pricingUpdateSchema.safeParse(body);
+ if (!parsed.success) {
+ const msg = parsed.error.issues[0]?.message || 'validation error';
+ return error(res, 400, 'validation_error', msg);
+ }
+
+ const { prices } = parsed.data;
+
+ await sql.transaction(async (tx) => {
+ // Deactivate all existing prices for this agent
+ await tx`
+ UPDATE agent_skill_prices SET is_active = false WHERE agent_id = ${agentId}
+ `;
+ // Insert or update new prices
+ for (const p of prices) {
+ await tx`
+ INSERT INTO agent_skill_prices (agent_id, skill, amount, currency_mint, chain, is_active)
+ VALUES (${agentId}, ${p.skill}, ${p.amount}, ${p.currency_mint}, ${p.chain}, true)
+ ON CONFLICT (agent_id, skill) DO UPDATE SET
+ amount = EXCLUDED.amount,
+ currency_mint = EXCLUDED.currency_mint,
+ chain = EXCLUDED.chain,
+ is_active = true,
+ updated_at = now()
+ `;
+ }
+ });
+
+ return json(res, 200, { ok: true });
+}
+
+async function resolveAuth(req) {
+ const session = await getSessionUser(req);
+ if (session) return { userId: session.id };
+ const bearer = await authenticateBearer(extractBearer(req));
+ if (bearer) return { userId: bearer.userId };
+ return null;
+}
diff --git a/api/pump/dashboard.js b/api/pump/dashboard.js
new file mode 100644
index 000000000..bf55cf5be
--- /dev/null
+++ b/api/pump/dashboard.js
@@ -0,0 +1,53 @@
+import { sql } from '../_lib/db.js';
+import { getSessionUser } from '../_lib/auth.js';
+import { json, error, wrap } from '../_lib/http.js';
+import { env } from '../_lib/env.js';
+
+const BIRDEYE_API_KEY = env.BIRDEYE_API_KEY;
+
+async function fetchWithCache(url, options, ttl = 60) {
+ // A real implementation would use Redis or a similar external cache
+ // For now, this is a placeholder
+ const resp = await fetch(url, options);
+ if (!resp.ok) {
+ const text = await resp.text();
+ throw new Error(`API error (${resp.status}): ${text}`);
+ }
+ return resp.json();
+}
+
+export default wrap(async (req, res) => {
+ const user = await getSessionUser(req);
+ if (!user) return error(res, 401, 'unauthorized');
+
+ const agentId = new URL(req.url, 'http://x').searchParams.get('agent_id');
+ if (!agentId) return error(res, 400, 'missing agent_id');
+
+ const [agent] = await sql`
+ SELECT meta FROM agent_identities
+ WHERE id = ${agentId} AND user_id = ${user.id} AND deleted_at IS NULL
+ `;
+
+ if (!agent) return error(res, 404, 'agent not found');
+
+ const tokenMint = agent.meta?.token?.mint;
+ if (!tokenMint) return error(res, 404, 'token not launched for this agent');
+
+ const headers = { 'X-API-KEY': BIRDEYE_API_KEY };
+
+ try {
+ const [price, history] = await Promise.all([
+ fetchWithCache(`https://public-api.birdeye.so/defi/price?address=${tokenMint}`, { headers }),
+ fetchWithCache(`https://public-api.birdeye.so/defi/txs/latest?address=${tokenMint}`, { headers })
+ ]);
+
+ return json(res, 200, {
+ price: price.data,
+ history: history.data.items,
+ });
+
+ } catch (e) {
+ console.error(`[pump-dashboard] Error fetching token data for ${tokenMint}:`, e);
+ return error(res, 502, 'bad_gateway', 'Failed to fetch on-chain data');
+ }
+});
diff --git a/api/sentiment.js b/api/sentiment.js
new file mode 100644
index 000000000..69353e410
--- /dev/null
+++ b/api/sentiment.js
@@ -0,0 +1,31 @@
+
+import { HfInference } from '@huggingface/inference';
+
+const hf = new HfInference(process.env.HF_TOKEN);
+
+export default async function handler(req, res) {
+ if (req.method !== 'POST') {
+ return res.status(405).json({ error: 'Method Not Allowed' });
+ }
+
+ const { text } = req.body;
+
+ if (!text || typeof text !== 'string') {
+ return res.status(400).json({ error: 'Invalid input: "text" must be a non-empty string.' });
+ }
+
+ try {
+ const result = await hf.textClassification({
+ model: 'distilbert-base-uncased-finetuned-sst-2-english',
+ inputs: text,
+ });
+
+ const positiveResult = result.find(item => item.label === 'POSITIVE');
+ const sentiment = positiveResult && positiveResult.score > 0.6 ? 'Positive' : 'Negative';
+
+ return res.status(200).json({ sentiment });
+ } catch (error) {
+ console.error('Error getting sentiment:', error);
+ return res.status(500).json({ error: 'Failed to analyze sentiment.' });
+ }
+}
diff --git a/character-studio/src/App.jsx b/character-studio/src/App.jsx
index 3ba01d881..1e0aa1545 100644
--- a/character-studio/src/App.jsx
+++ b/character-studio/src/App.jsx
@@ -159,7 +159,9 @@ export default function App() {
[ViewMode.BATCHDOWNLOAD]: <BatchDownload />,
[ViewMode.LOAD]: <Load />,
[ViewMode.MINT]: <Mint />,
- [ViewMode.SAVE]: <Save />,
+ [ViewMode.SAVE]: <Save />,
+ [ViewMode.STUDIO]: <Studio />,
+ }
[ViewMode.STUDIO]: <Studio />,
}
diff --git a/character-studio/src/context/ViewContext.jsx b/character-studio/src/context/ViewContext.jsx
index d60ff6936..dac7bf02d 100644
--- a/character-studio/src/context/ViewContext.jsx
+++ b/character-studio/src/context/ViewContext.jsx
@@ -18,7 +18,8 @@ export const ViewMode = {
MINT: "MINT",
OPTIMIZER: "OPTIMIZER",
BATCHMANIFEST: "BATCHMANIFEST",
- WALLET: "WALLET"
+ WALLET: "WALLET",
+ STUDIO: "STUDIO"
}
export const ViewContext = React.createContext()
diff --git a/character-studio/src/pages/Landing.jsx b/character-studio/src/pages/Landing.jsx
index f21e881ad..4e49a8af8 100644
--- a/character-studio/src/pages/Landing.jsx
+++ b/character-studio/src/pages/Landing.jsx
@@ -68,6 +68,9 @@ function Landing() {
loadCharacter
}><img src='/assets/media/btn_load_character.png' /></button>
*/}
+ <button className={styles.button} onClick={() => setViewMode(ViewMode.STUDIO)}>
+ Studio
+ </button>
</div>
</div>
)
diff --git a/claude.sh b/claude.sh
index a6e353698..b728cd30e 100644
--- a/claude.sh
+++ b/claude.sh
@@ -21,6 +21,7 @@ set -e
# format Format the codebase with Prettier.
# clean Clean up build artifacts.
# deploy Deploy the project to Vercel (with confirmation).
+# deploy-agent Package an agent for deployment.
# help Show this help message.
# ---
@@ -153,6 +154,19 @@ function deploy() {
print_success "Project deployed."
}
+# Deploy a single agent
+function deploy_agent() {
+ print_header "Deploying Agent: $1"
+ if [ -z "$1" ]; then
+ print_error "Agent name not provided."
+ echo "Usage: ./claude.sh deploy-agent <agent_name>"
+ exit 1
+ fi
+ cd "$ROOT_DIR"
+ node scripts/deploy-agent.mjs "$1"
+ print_success "Agent packaged successfully."
+}
+
# Show the help message
function help() {
# Extract the help text from the script's header comments
@@ -203,6 +217,9 @@ function main() {
deploy)
deploy
;;
+ deploy-agent)
+ deploy_agent "$2"
+ ;;
help)
help
;;
diff --git a/package.json b/package.json
index c22f4d20e..e2050e782 100644
--- a/package.json
+++ b/package.json
@@ -85,7 +85,8 @@
"@coral-xyz/anchor": "^0.31.1",
"@gltf-transform/core": "^4.3.0",
"@gltf-transform/extensions": "^4.3.0",
- "@jup-ag/api": "^6.0.48",
+ " "@huggingface/inference": "^2.7.0",
+ "@jup-ag/api": "^6.0.48",
"@metaplex-foundation/mpl-core": "^1.10.0",
"@metaplex-foundation/umi": "^1.5.1",
"@metaplex-foundation/umi-bundle-defaults": "^1.5.1",
diff --git a/public/ai-stream.css b/public/ai-stream.css
new file mode 100644
index 000000000..fc38247f0
--- /dev/null
+++ b/public/ai-stream.css
@@ -0,0 +1,113 @@
+:root {
+ --border: #1f1f29;
+ --bg: #000;
+ --panel: #14141c;
+ --muted: #888;
+}
+html, body {
+ margin: 0;
+ padding: 0;
+ width: 100vw;
+ height: 100vh;
+ overflow: hidden;
+ background: var(--bg);
+ color: #eee;
+ font-family: 'Inter', sans-serif;
+}
+.ai-stream-page {
+ display: flex;
+ flex-direction: column;
+ height: 100vh;
+}
+.ai-stream-header {
+ display: flex;
+ align-items: center;
+ padding: 10px 18px;
+ border-bottom: 1px solid var(--border);
+ background: rgba(10,10,15,0.8);
+ backdrop-filter: blur(8px);
+ z-index: 100;
+}
+.ai-stream-header h1 {
+ margin: 0;
+ font-size: 16px;
+ font-weight: 600;
+}
+.ai-stream-header h1 a {
+ color: #eee;
+ text-decoration: none;
+ display: flex;
+ align-items: center;
+ gap: 10px;
+}
+.ai-stream-header h1 img {
+ height: 20px;
+}
+.ai-stream-header .controls {
+ margin-left: auto;
+ display: flex;
+ align-items: center;
+ gap: 12px;
+}
+.ai-stream-header select, .ai-stream-header button {
+ background: #161620;
+ color: #eee;
+ border: 1px solid #2a2a36;
+ border-radius: 6px;
+ padding: 6px 10px;
+ font-size: 13px;
+ cursor: pointer;
+}
+.ai-stream-header button.toggle[data-on="0"] { color: var(--muted); }
+.ai-stream-header .status {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ font-size: 12px;
+ color: var(--muted);
+ margin-left: 16px;
+}
+.dot {
+ width: 8px;
+ height: 8px;
+ border-radius: 50%;
+ background: #555;
+}
+.dot.live { background: #4ade80; }
+.dot.connecting { background: #fbbf24; }
+.dot.down { background: #f87171; }
+
+.ai-stream-main {
+ flex: 1;
+ display: grid;
+ grid-template-columns: 1fr 380px;
+ min-height: 0;
+}
+#stage {
+ position: relative;
+ background: radial-gradient(ellipse at center, #1a1a26 0%, #0a0a12 70%);
+}
+#agent {
+ width: 100%;
+ height: 100%;
+ border: 0;
+}
+#feed-container {
+ border-left: 1px solid var(--border);
+ background: var(--panel);
+ overflow-y: auto;
+ padding: 10px;
+}
+#feed {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+}
+/* Event card styles from pumpfun.html can be reused here */
+.evt {
+ border: 1px solid #232330;
+ background: #15151d;
+ border-radius: 8px;
+ padding: 10px 12px;
+ font-size: 12px;
+}
diff --git a/public/ai-stream.html b/public/ai-stream.html
new file mode 100644
index 000000000..3bc7102b9
--- /dev/null
+++ b/public/ai-stream.html
@@ -0,0 +1,120 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
+ <title>AI Stream · three.ws</title>
+ <link rel="icon" href="/favicon.ico" />
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
+ <link rel="stylesheet" href="/style.css" />
+ <link rel="stylesheet" href="/ai-stream.css" />
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap" rel="stylesheet" />
+</head>
+<body class="ai-stream-page">
+ <header class="ai-stream-header">
+ <h1><a href="/"><img src="/three.svg" alt="three.ws" /> AI Stream</a></h1>
+ <div class="controls">
+ <button id="ctl-avatar-btn" type="button" aria-haspopup="dialog" aria-expanded="false" title="Choose avatar">
+ <span class="avatar-thumb" id="ctl-avatar-thumb" aria-hidden="true"></span>
+ <span class="avatar-name" id="ctl-avatar-label">Avatar</span>
+ <span class="avatar-caret" aria-hidden="true">▾</span>
+ </button>
+ <select id="ctl-mood" title="Avatar mood — biases reaction intensity">
+ <option value="chill">😎 Chill</option>
+ <option value="normal" selected>🙂 Normal</option>
+ <option value="hype">🤩 Hype</option>
+ </select>
+ <button id="ctl-narrate" class="toggle" type="button" data-on="1" title="Toggle agent narration">🔊</button>
+ </div>
+ <div class="status">
+ <span id="status-dot" class="dot connecting"></span><span id="status-label">connecting…</span>
+ </div>
+ </header>
+
+ <main class="ai-stream-main">
+ <div id="stage">
+ <iframe id="agent" allow="autoplay" title="3D agent"></iframe>
+ </div>
+ <aside id="feed-container">
+ <div id="feed"></div>
+ </aside>
+ </main>
+
+ <!-- Re-using the same modals and logic from pumpfun.html -->
+ <div class="pf-modal-backdrop" id="avatar-picker" data-open="false" role="dialog" aria-modal="true" aria-labelledby="avatar-picker-title">
+ <div class="pf-modal" role="document">
+ <div class="pf-modal-head">
+ <h2 id="avatar-picker-title">Choose an avatar</h2>
+ <span class="spacer"></span>
+ <button class="pf-modal-close" type="button" aria-label="Close" data-picker-close>×</button>
+ </div>
+ <div class="pf-tabs" role="tablist">
+ <button class="pf-tab" role="tab" type="button" data-tab="defaults" aria-selected="true">Defaults</button>
+ <button class="pf-tab" role="tab" type="button" data-tab="mine">My Agents</button>
+ <button class="pf-tab" role="tab" type="button" data-tab="community">Community</button>
+ </div>
+ <div class="pf-toolbar">
+ <input type="search" id="picker-search" placeholder="Search..." />
+ </div>
+ <div class="pf-content">
+ <div class="pf-body" id="picker-body"></div>
+ <aside class="pf-preview" aria-label="Avatar preview">
+ <div class="pf-preview-stage" id="picker-preview-stage"></div>
+ <div class="pf-preview-meta" id="picker-preview-meta"></div>
+ </aside>
+ </div>
+ </div>
+ </div>
+
+ <script>
+ // This will be a simplified version of the script from pumpfun.html
+ // focusing on the core agent + feed functionality.
+ const $ = (id) => document.getElementById(id);
+
+ // Global state
+ const params = {
+ narrate: true,
+ mood: 'normal',
+ avatar: '/avatars/cz.glb',
+ };
+
+ // Iframe and agent communication
+ const iframe = $('agent');
+
+ function mountAgent() {
+ const modelHash = '&model=' + encodeURIComponent(params.avatar);
+ const widgetId = 'wdgt_demo_pumpfun_stream';
+ iframe.src = `/app#widget=${widgetId}&kiosk=true&type=pumpfun-feed${modelHash}`;
+ }
+
+ // Live feed connection
+ function connectFeed() {
+ const statusDot = $('status-dot');
+ const statusLabel = $('status-label');
+ statusDot.className = 'dot live';
+ statusLabel.textContent = 'live';
+ // WebSocket connection logic will be added here
+ }
+
+ // Initial setup
+ function init() {
+ mountAgent();
+ connectFeed();
+
+ $('ctl-narrate').addEventListener('click', (e) => {
+ params.narrate = !params.narrate;
+ e.currentTarget.dataset.on = params.narrate ? '1' : '0';
+ });
+
+ $('ctl-mood').addEventListener('change', (e) => {
+ params.mood = e.target.value;
+ });
+
+ // Avatar picker logic will be added here
+ }
+
+ init();
+ </script>
+</body>
+</html>
diff --git a/public/crypto-agent-manifest.json b/public/crypto-agent-manifest.json
new file mode 100644
index 000000000..a45765fbd
--- /dev/null
+++ b/public/crypto-agent-manifest.json
@@ -0,0 +1,24 @@
+{
+ "spec": "agent-manifest/0.2",
+ "name": "Crypto Oracle",
+ "description": "A crypto expert agent that can provide real-time price information.",
+ "body": {
+ "uri": "https://cdn.three.ws/models/sample-avatar.glb",
+ "format": "gltf-binary"
+ },
+ "brain": {
+ "provider": "anthropic",
+ "model": "claude-sonnet-4-6",
+ "instructions": "You are a crypto expert. You can provide real-time price information for any cryptocurrency. When asked for a price, use the getPrice tool. For example, to get the price of Solana, you would call getPrice({ coin_id: 'solana', vs_currency: 'usd' }).",
+ "temperature": 0.7,
+ "maxTokens": 1024
+ },
+ "voice": {
+ "tts": { "provider": "browser" },
+ "stt": { "provider": "browser" }
+ },
+ "memory": { "mode": "local" },
+ "skills": [
+ { "uri": "/skills/crypto-price/" }
+ ]
+}
diff --git a/public/crypto-demo.html b/public/crypto-demo.html
new file mode 100644
index 000000000..1ee4829cd
--- /dev/null
+++ b/public/crypto-demo.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>3D-Agent Crypto Demo</title>
+ <style>
+ body { margin: 0; background: #1a1a1a; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; font-family: sans-serif; }
+ agent-3d { width: 400px; height: 560px; display: block; border-radius: 16px; box-shadow: 0 0 20px rgba(0,0,0,0.5); }
+ h1 { margin-bottom: 20px; }
+ </style>
+</head>
+<body>
+ <h1>Crypto Agent Demo</h1>
+ <script type="module" src="/agent-3d/latest/agent-3d.js"></script>
+
+ <agent-3d
+ id="crypto-agent"
+ manifest="/crypto-agent-manifest.json"
+ ></agent-3d>
+
+</body>
+</html>
diff --git a/public/skills/crypto-price/SKILL.md b/public/skills/crypto-price/SKILL.md
new file mode 100644
index 000000000..cfdbd769e
--- /dev/null
+++ b/public/skills/crypto-price/SKILL.md
@@ -0,0 +1,3 @@
+# Crypto Price Skill
+
+This skill allows the agent to fetch real-time price information for various cryptocurrencies using the CoinGecko API.
diff --git a/public/skills/crypto-price/handlers.js b/public/skills/crypto-price/handlers.js
new file mode 100644
index 000000000..1729e489c
--- /dev/null
+++ b/public/skills/crypto-price/handlers.js
@@ -0,0 +1,27 @@
+export default {
+ async getPrice(args, ctx) {
+ const { coin_id, vs_currency } = args;
+ if (!coin_id || !vs_currency) {
+ return { ok: false, error: 'coin_id and vs_currency are required' };
+ }
+
+ try {
+ const url = `https://api.coingecko.com/api/v3/simple/price?ids=${coin_id}&vs_currencies=${vs_currency}`;
+ const response = await fetch(url);
+ if (!response.ok) {
+ return { ok: false, error: `API request failed with status ${response.status}` };
+ }
+ const data = await response.json();
+
+ if (data[coin_id] && data[coin_id][vs_currency]) {
+ const price = data[coin_id][vs_currency];
+ return { ok: true, output: `The current price of ${coin_id} is ${price} ${vs_currency.toUpperCase()}.` };
+ } else {
+ return { ok: false, error: `Could not retrieve price for ${coin_id} in ${vs_currency}` };
+ }
+ } catch (error) {
+ console.error('Error fetching crypto price:', error);
+ return { ok: false, error: 'An error occurred while fetching the price.' };
+ }
+ }
+};
diff --git a/public/skills/crypto-price/tools.json b/public/skills/crypto-price/tools.json
new file mode 100644
index 000000000..1520e20e5
--- /dev/null
+++ b/public/skills/crypto-price/tools.json
@@ -0,0 +1,20 @@
+[
+ {
+ "name": "getPrice",
+ "description": "Get the current price of a specific cryptocurrency in a given currency.",
+ "input_schema": {
+ "type": "object",
+ "properties": {
+ "coin_id": {
+ "type": "string",
+ "description": "The ID of the cryptocurrency (e.g., 'solana', 'bitcoin', 'ethereum')."
+ },
+ "vs_currency": {
+ "type": "string",
+ "description": "The currency to compare against (e.g., 'usd', 'eur', 'jpy')."
+ }
+ },
+ "required": ["coin_id", "vs_currency"]
+ }
+ }
+]
diff --git a/pump-visualizer.html b/pump-visualizer.html
new file mode 100644
index 000000000..9d5f21ca2
--- /dev/null
+++ b/pump-visualizer.html
@@ -0,0 +1,45 @@
+
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>3D-Agent · Pump.fun Visualizer</title>
+ <meta name="description" content="A real-time 3D visualization of trending tokens on Pump.fun.">
+ <link rel="stylesheet" href="/style.css">
+ <style>
+ body { margin: 0; overflow: hidden; }
+ canvas { display: block; }
+ </style>
+</head>
+<body>
+ <script type="module">
+ import * as THREE from 'three';
+
+ // Scene setup
+ const scene = new THREE.Scene();
+ const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
+ const renderer = new THREE.WebGLRenderer();
+ renderer.setSize(window.innerWidth, window.innerHeight);
+ document.body.appendChild(renderer.domElement);
+
+ // Placeholder object
+ const geometry = new THREE.BoxGeometry();
+ const material = new THREE.MeshBasicMaterial({ color: 0x00ff00 });
+ const cube = new THREE.Mesh(geometry, material);
+ scene.add(cube);
+
+ camera.position.z = 5;
+
+ // Animation loop
+ function animate() {
+ requestAnimationFrame(animate);
+ cube.rotation.x += 0.01;
+ cube.rotation.y += 0.01;
+ renderer.render(scene, camera);
+ }
+
+ animate();
+ </script>
+</body>
+</html>
diff --git a/scripts/deploy-agent.mjs b/scripts/deploy-agent.mjs
new file mode 100644
index 000000000..e49c0a661
--- /dev/null
+++ b/scripts/deploy-agent.mjs
@@ -0,0 +1,74 @@
+#!/usr/bin/env node
+import fs from 'fs/promises';
+import path from 'path';
+import archiver from 'archiver';
+
+const AGENTS_DIR = path.resolve(process.cwd(), 'src', 'agents');
+const DIST_DIR = path.resolve(process.cwd(), 'dist');
+
+async function getAgentConfig(agentName) {
+ const agentConfigFile = path.join(AGENTS_DIR, `${agentName}.js`);
+ try {
+ const config = await import(agentConfigFile);
+ return config.default;
+ } catch (error) {
+ console.error(`Error: Could not load agent configuration for "${agentName}".`);
+ console.error(`Make sure "src/agents/${agentName}.js" exists and is a valid module.`);
+ throw error;
+ }
+}
+
+async function packageAgent(agentName, agentConfig) {
+ await fs.mkdir(DIST_DIR, { recursive: true });
+ const zipPath = path.join(DIST_DIR, `${agentName}.zip`);
+ const output = fs.createWriteStream(zipPath);
+ const archive = archiver('zip', {
+ zlib: { level: 9 }
+ });
+
+ return new Promise((resolve, reject) => {
+ output.on('close', () => {
+ console.log(`✅ Agent package created at: ${zipPath}`);
+ console.log(`Total size: ${archive.pointer()} bytes`);
+ resolve(zipPath);
+ });
+ archive.on('error', (err) => reject(err));
+
+ archive.pipe(output);
+
+ // Add agent config
+ archive.file(path.join(AGENTS_DIR, `${agentName}.js`), { name: 'agent.js' });
+
+ // Add 3D model
+ if (agentConfig.model) {
+ const modelPath = path.resolve(process.cwd(), 'public', agentConfig.model);
+ archive.file(modelPath, { name: path.basename(agentConfig.model) });
+ }
+
+ // Add other assets if specified
+ // (This can be extended to include skills, etc.)
+
+ archive.finalize();
+ });
+}
+
+async function main() {
+ const agentName = process.argv[2];
+ if (!agentName) {
+ console.error('Error: Please provide an agent name.');
+ console.log('Usage: node scripts/deploy-agent.mjs <agent_name>');
+ process.exit(1);
+ }
+
+ console.log(`📦 Starting deployment process for agent: "${agentName}"...`);
+
+ const agentConfig = await getAgentConfig(agentName);
+ await packageAgent(agentName, agentConfig);
+
+ console.log(`🚀 Deployment package for "${agentName}" is ready!`);
+}
+
+main().catch(err => {
+ console.error('Deployment failed:', err);
+ process.exit(1);
+});
diff --git a/src/agent-detail.js b/src/agent-detail.js
index be6c31908..186b5353f 100644
--- a/src/agent-detail.js
+++ b/src/agent-detail.js
@@ -249,18 +249,53 @@ function renderNotFound(id, reason) {
modal.classList.add('hidden');
});
- confirmWithdrawBtn.addEventListener('click', () => {
- const amount = withdrawAmountInput.value;
- const recipient = recipientAddressInput.value;
+ confirmWithdrawBtn.addEventListener('click', async () => {
+ if (!wallet) {
+ alert('Please connect your wallet first.');
+ return;
+ }
+
+ const amount = parseFloat(withdrawAmountInput.value);
+ const recipientAddress = recipientAddressInput.value;
+
+ if (isNaN(amount) || amount <= 0) {
+ alert('Please enter a valid amount.');
+ return;
+ }
+
+ if (!recipientAddress) {
+ alert('Please enter a recipient address.');
+ return;
+ }
- if (amount && recipient) {
- alert(`Withdrawal of ${amount} SOL to ${recipient} initiated. (This is a placeholder)`);
- console.log('Withdraw:', { amount, recipient });
+ try {
+ const recipientPubKey = new solanaWeb3.PublicKey(recipientAddress);
+ const transaction = new solanaWeb3.Transaction().add(
+ solanaWeb3.SystemProgram.transfer({
+ fromPubkey: wallet,
+ toPubkey: recipientPubKey,
+ lamports: amount * solanaWeb3.LAMPORTS_PER_SOL,
+ })
+ );
+
+ transaction.feePayer = wallet;
+ const { blockhash } = await connection.getRecentBlockhash();
+ transaction.recentBlockhash = blockhash;
+
+ const provider = getProvider();
+ const signedTransaction = await provider.signTransaction(transaction);
+ const signature = await connection.sendRawTransaction(signedTransaction.serialize());
+ await connection.confirmTransaction(signature);
+
+ alert(`Withdrawal of ${amount} SOL to ${recipientAddress} successful!`);
+ console.log('Transaction signature:', signature);
modal.classList.add('hidden');
withdrawAmountInput.value = '';
recipientAddressInput.value = '';
- } else {
- alert('Please fill out both fields.');
+
+ } catch (error) {
+ console.error('Withdrawal failed:', error);
+ alert(`Withdrawal failed: ${error.message}`);
}
});
@@ -413,6 +448,38 @@ async function loadAgent(id) {
return { agent: normalize(rec, avatar), error: null };
}
+// --- Wallet Integration ---
+
+const getProvider = () => {
+ if ('phantom' in window) {
+ const provider = window.phantom?.solana;
+ if (provider?.isPhantom) {
+ return provider;
+ }
+ }
+ window.open('https://phantom.app/', '_blank');
+ return null;
+};
+
+let wallet = null;
+const connection = new solanaWeb3.Connection(solanaWeb3.clusterApiUrl('devnet'), 'confirmed');
+const connectWalletBtn = document.getElementById('connect-wallet-btn');
+
+connectWalletBtn.addEventListener('click', async () => {
+ const provider = getProvider();
+ if (provider) {
+ try {
+ const resp = await provider.connect();
+ wallet = resp.publicKey;
+ console.log('Wallet connected:', wallet.toString());
+ connectWalletBtn.textContent = `${wallet.toString().slice(0, 4)}...${wallet.toString().slice(-4)}`;
+ } catch (err) {
+ console.error('Failed to connect to wallet:', err);
+ }
+ }
+});
+
+
const id = new URLSearchParams(location.search).get('id') || location.pathname.match(/\/agents\/([^/]+)/)?.[1];
loadAgent(id)
.then(({ agent, error }) => {
diff --git a/src/agent-protocol.js b/src/agent-protocol.js
index a8dcc55eb..7b46d1d36 100644
--- a/src/agent-protocol.js
+++ b/src/agent-protocol.js
@@ -16,6 +16,7 @@ export const ACTION_TYPES = {
PERFORM_SKILL: 'perform-skill', // a skill is starting execution
SKILL_DONE: 'skill-done', // a skill finished (success + result payload)
SKILL_ERROR: 'skill-error', // a skill failed
+ SENTIMENT_ANALYZED: 'sentiment-analyzed', // sentiment analysis was performed
REMEMBER: 'remember', // agent stored a memory
SIGN: 'sign', // agent signs an action with its wallet
LOAD_START: 'load-start', // model/asset loading started
diff --git a/src/agent-skills-sentiment.js b/src/agent-skills-sentiment.js
new file mode 100644
index 000000000..b0b3002a0
--- /dev/null
+++ b/src/agent-skills-sentiment.js
@@ -0,0 +1,65 @@
+
+import { ACTION_TYPES } from './agent-protocol.js';
+
+export function registerSentimentSkills(agentSkills) {
+ agentSkills.register({
+ name: 'analyze-sentiment',
+ description: 'Analyzes the sentiment of a given text.',
+ instruction: 'Determine if the provided text has a positive, negative, or neutral sentiment.',
+ animationHint: 'think',
+ voicePattern: 'Analyzing the sentiment of "{{text}}"...',
+ mcpExposed: true,
+ inputSchema: {
+ type: 'object',
+ properties: {
+ text: {
+ type: 'string',
+ description: 'The text to be analyzed.'
+ },
+ },
+ required: ['text'],
+ },
+ handler: async (args, ctx) => {
+ const { text } = args;
+
+ if (!text) {
+ return {
+ success: false,
+ output: 'No text provided for sentiment analysis.',
+ };
+ }
+
+ try {
+ const response = await fetch('/api/sentiment', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ text }),
+ });
+
+ if (!response.ok) {
+ throw new Error(`Sentiment API failed with status: ${response.status}`);
+ }
+
+ const { sentiment } = await response.json();
+
+ ctx.protocol.emit({
+ type: ACTION_TYPES.SENTIMENT_ANALYZED,
+ payload: { text, sentiment },
+ agentId: ctx.identity?.id || 'default',
+ });
+
+ return {
+ success: true,
+ output: `The sentiment of "${text}" is ${sentiment}.`,
+ data: { text, sentiment },
+ };
+ } catch (error) {
+ console.error('Sentiment analysis failed:', error);
+ return {
+ success: false,
+ output: 'Failed to analyze sentiment.',
+ };
+ }
+ },
+ });
+}
diff --git a/src/agent-skills.js b/src/agent-skills.js
index 317f599f4..cd0d5ffbd 100644
--- a/src/agent-skills.js
+++ b/src/agent-skills.js
@@ -21,6 +21,7 @@ import { registerJupiterSkills } from './agent-skills-jupiter.js';
import { registerBlinksSkills } from './agent-skills-blinks.js';
import { registerNftSkills } from './agent-skills-nfts.js';
import { registerSceneSkills } from './agent-skills-scene.js';
+import { registerSentimentSkills } from './agent-skills-sentiment.js';
/**
* @typedef {Object} SkillContext
@@ -71,6 +72,7 @@ export class AgentSkills {
registerBlinksSkills(this);
registerNftSkills(this);
registerSceneSkills(this);
+ registerSentimentSkills(this);
}
// ── Registry ──────────────────────────────────────────────────────────────
diff --git a/src/app.js b/src/app.js
index 4f64e12ac..ffc28f968 100644
--- a/src/app.js
+++ b/src/app.js
@@ -27,6 +27,7 @@ import { AgentIdentity } from './agent-identity.js';
import { AgentSkills } from './agent-skills.js';
import { AgentAvatar } from './agent-avatar.js';
import { AgentHome } from './agent-home.js';
+import { setSceneViewer } from './agent-skills-scene.js';
// Runtime — LLM brain, scene control, file-based memory, skill bundles
import { SceneController } from './runtime/scene.js';
@@ -34,11 +35,19 @@ import { Runtime } from './runtime/index.js';
import { Memory } from './memory/index.js';
import { SkillRegistry } from './skills/index.js';
-// Wallet — kick off a silent reconnect on app boot. Any page that later mounts
-// a wallet UI (deploy, reputation, validation, permissions, etc.) reads from
-// the shared signer + onWalletChange bus, so this single call surfaces an
-// already-authorized wallet site-wide without any popup.
-import { eagerConnectWallet } from './erc8004/agent-registry.js';
+ window.VIEWER.runtime = new Runtime({
+ manifest: {},
+ viewer,
+ memory: new Memory({ agentId: 'user' }),
+ skills: new AgentSkills(protocol, new Memory({ agentId: 'user' })),
+ agentId: 'user',
+ });
+
+ // Wallet — kick off a silent reconnect on app boot. Any page that later mounts
+ // a wallet UI (deploy, reputation, validation, permissions, etc.) reads from
+ // the shared signer + onWalletChange bus, so this single call surfaces an
+ // already-authorized wallet site-wide without any popup.
+ eagerConnectWallet();
window.THREE = THREE;
window.VIEWER = {};
diff --git a/src/marketplace.js b/src/marketplace.js
index a0ac8ab72..52788ab5f 100644
--- a/src/marketplace.js
+++ b/src/marketplace.js
@@ -201,28 +201,12 @@ async function loadDetail(id) {
els.detail.hidden = false;
els.detail.scrollIntoView({ behavior: 'instant', block: 'start' });
- try {
- const [aR, vR, sR] = await Promise.all([
- fetch(`${API}/agents/${id}`),
- fetch(`${API}/agents/${id}/versions`),
- fetch(`${API}/agents/${id}/similar`),
- ]);
- const aJ = await aR.json();
- if (!aR.ok) {
- renderDetailError(aJ?.error_description || 'Agent not found');
- return;
- }
- const a = aJ.data.agent;
- detailState = { agent: a, bookmarked: !!aJ.data.bookmarked };
- renderDetail(a, aJ.data.bookmarked);
- renderVersions((await vR.json())?.data?.versions || []);
- renderSimilar((await sR.json())?.data?.items || []);
-
- // Fire-and-forget view counter.
- fetch(`${API}/agents/${id}/view`, { method: 'POST' }).catch(() => {});
- } catch (err) {
- console.error('[marketplace] detail', err);
- renderDetailError('Failed to load agent.');
+ const agent = state.items.find(item => item.id === id);
+ if (agent) {
+ detailState = { agent: agent, bookmarked: false };
+ renderDetail(agent, false);
+ } else {
+ renderDetailError('Agent not found');
}
}
@@ -237,21 +221,21 @@ function renderDetailError(msg) {
function renderDetail(a, bookmarked) {
$('d-name').textContent = a.name || 'Untitled';
- $('d-avatar').textContent = initial(a.name);
- $('d-author').textContent = a.author_name || 'Anonymous';
- $('d-published').textContent = a.published_at ? formatDate(a.published_at) : formatDate(a.created_at);
+ $('d-avatar').textContent = a.avatar;
+ $('d-author').textContent = a.author || 'Anonymous';
+ $('d-published').textContent = a.published ? formatDate(a.published) : '';
$('d-category').textContent = CATEGORY_LABELS[a.category] || a.category || 'General';
- $('d-views').textContent = `⊙ ${a.views_count || 0}`;
+ $('d-views').textContent = `⊙ ${a.views || 0}`;
$('d-overview').textContent = a.description || '';
$('d-overview-side').textContent = a.description || '';
$('d-greeting').textContent = a.greeting || `Hello! I am ${a.name}. How can I help you today?`;
- $('d-profile').textContent = a.system_prompt || '(No profile yet.)';
+ $('d-profile').textContent = a.prompt || '(No profile yet.)';
$('d-bookmark').classList.toggle('on', bookmarked);
$('d-bookmark').textContent = bookmarked ? '★' : '☆';
const forksEl = $('d-forks-pill');
- if (a.forks_count > 0) {
- forksEl.textContent = `⑂ ${a.forks_count} forks`;
+ if (a.forks > 0) {
+ forksEl.textContent = `⑂ ${a.forks} forks`;
forksEl.hidden = false;
} else {
forksEl.hidden = true;
@@ -369,7 +353,7 @@ async function fork() {
if (!r.ok) throw new Error(j?.error_description || 'Fork failed');
// Send the user to chat with their new fork.
const newId = j?.data?.agent?.id;
- if (newId) location.href = `/agent/${newId}`;
+ if (newId) location.href = `/agent-detail.html?id=${newId}`;
} catch (err) {
alert(err.message || 'Fork failed');
}
diff --git a/src/pump/dashboard.js b/src/pump/dashboard.js
new file mode 100644
index 000000000..c571c2df9
--- /dev/null
+++ b/src/pump/dashboard.js
@@ -0,0 +1,46 @@
+// For now, this is a placeholder for the full dashboard implementation.
+// It will fetch data from the new API endpoint and render it.
+
+async function main() {
+ const loadingEl = document.getElementById('loading');
+ const dashboardEl = document.getElementById('dashboard-content');
+ const agentId = new URL(location.href).searchParams.get('agent');
+
+ if (!agentId) {
+ loadingEl.textContent = 'Error: No agent ID specified in URL.';
+ return;
+ }
+
+ try {
+ const resp = await fetch(`/api/pump/dashboard?agent_id=${agentId}`, { credentials: 'include' });
+ if (!resp.ok) {
+ const err = await resp.json();
+ throw new Error(err.error_description || 'Failed to load dashboard data.');
+ }
+ const data = await resp.json();
+
+ document.getElementById('price-usd').textContent = `$${data.price?.value.toFixed(6) || 'N/A'}`;
+
+ // Placeholder for market cap - Birdeye price endpoint doesn't include it.
+ // A different endpoint would be needed for a full implementation.
+ document.getElementById('market-cap').textContent = `$${(data.price?.marketCap || 'N/A')}`;
+
+ const historyEl = document.getElementById('trade-history');
+ historyEl.innerHTML = data.history.map(tx => `
+ <div class="trade-item">
+ <span class="${tx.side.toLowerCase()}">${tx.side}</span>
+ <span>${tx.amount.toFixed(2)}</span>
+ <span>$${(tx.priceUsd * tx.amount).toFixed(2)}</span>
+ <a href="https://solscan.io/tx/${tx.txHash}" target="_blank" rel="noopener">View</a>
+ </div>
+ `).join('');
+
+ loadingEl.hidden = true;
+ dashboardEl.hidden = false;
+
+ } catch (e) {
+ loadingEl.textContent = `Error: ${e.message}`;
+ }
+}
+
+main();
diff --git a/src/pump/launch-token-boot.js b/src/pump/launch-token-boot.js
index 1a652b569..a7af88157 100644
--- a/src/pump/launch-token-boot.js
+++ b/src/pump/launch-token-boot.js
@@ -22,19 +22,28 @@ function _mount() {
.then((data) => {
const rawAgent = data?.agent || null;
if (!rawAgent?.user_id) return; // not the owner
- if (rawAgent?.meta?.token?.mint) return; // already launched
const btn = document.getElementById('agent-stage-launch');
if (!btn) return;
- btn.hidden = false;
- btn.addEventListener('click', () => {
- openLaunchTokenModal({
- agentId,
- agentName: identity.name,
- imageUrl:
- rawAgent.avatar_thumbnail_url || rawAgent.meta?.thumbnail_url || '',
+
+ if (rawAgent?.meta?.token?.mint) {
+ // Token launched, show dashboard button
+ btn.textContent = 'View Token Dashboard';
+ btn.addEventListener('click', () => {
+ window.open(`/pump-dashboard.html?agent=${agentId}`, '_blank');
});
- });
+ } else {
+ // Not launched yet, show launch button
+ btn.addEventListener('click', () => {
+ openLaunchTokenModal({
+ agentId,
+ agentName: identity.name,
+ imageUrl:
+ rawAgent.avatar_thumbnail_url || rawAgent.meta?.thumbnail_url || '',
+ });
+ });
+ }
+ btn.hidden = false;
})
.catch(() => {});
}
diff --git a/src/widgets/pumpfun-reactions.js b/src/widgets/pumpfun-reactions.js
index 521dd26aa..928c48d55 100644
--- a/src/widgets/pumpfun-reactions.js
+++ b/src/widgets/pumpfun-reactions.js
@@ -161,7 +161,7 @@ function graduationReaction(s) {
icon: '🚀🌕',
emote: { trigger: 'celebration', weight: 1.0 },
gesture: { name: 'thriller', duration: 9000 },
- speak: { text: `Moonshot! $${s.symbol || s.name} just went ${fmtMult(s.mcMultiple)} — bonded to PumpAMM.`, sentiment: 0.95 },
+ speak: { text: `Moonshot! $${s.symbol || s.name} just went ${fmtMult(s.mcMultiple)} — bonded to PumpAMM.${s.aiTake ? ' — ' + s.aiTake : ''}`, sentiment: 0.95 },
lookAt: 'camera',
priority: 100,
};
@@ -172,7 +172,7 @@ function graduationReaction(s) {
icon: '🎓🔥',
emote: { trigger: 'celebration', weight: 0.95 },
gesture: { name: 'rumba', duration: 7000 },
- speak: { text: `Giant pump: $${s.symbol || s.name} ${fmtMult(s.mcMultiple)} into PumpAMM.`, sentiment: 0.85 },
+ speak: { text: `Giant pump: $${s.symbol || s.name} ${fmtMult(s.mcMultiple)} into PumpAMM.${s.aiTake ? ' — ' + s.aiTake : ''}`, sentiment: 0.85 },
lookAt: 'camera',
priority: 95,
};
@@ -183,7 +183,7 @@ function graduationReaction(s) {
icon: '🎓👑',
emote: { trigger: 'celebration', weight: 0.85 },
gesture: { name: 'capoeira', duration: 6500 },
- speak: { text: `Serial creator strikes again — $${s.symbol || s.name} graduated. ${s.creatorGraduated} grads now.`, sentiment: 0.7 },
+ speak: { text: `Serial creator strikes again — $${s.symbol || s.name} graduated. ${s.creatorGraduated} grads now.${s.aiTake ? ' — ' + s.aiTake : ''}`, sentiment: 0.7 },
lookAt: 'camera',
priority: 92,
};
@@ -193,7 +193,7 @@ function graduationReaction(s) {
icon: '🎓',
emote: { trigger: 'celebration', weight: 0.9 },
gesture: { name: 'rumba', duration: clampDur(4500 + Math.log10(Math.max(s.mcMultiple, 1) + 1) * 1500, 4500, 8000) },
- speak: { text: `Migration: $${s.symbol || s.name} bonded to PumpAMM.`, sentiment: 0.7 },
+ speak: { text: `Migration: $${s.symbol || s.name} bonded to PumpAMM.${s.aiTake ? ' — ' + s.aiTake : ''}`, sentiment: 0.7 },
lookAt: 'camera',
priority: 90,
};
@@ -263,7 +263,7 @@ function claimReaction(s) {
icon: '🚨',
emote: { trigger: 'celebration', weight: 0.85 },
gesture: { name: 'celebrate', duration: 4500 },
- speak: { text: `First-time claim on $${s.symbol || 'a new token'}.`, sentiment: 0.7 },
+ speak: { text: `First-time claim on $${s.symbol || 'a new token'}.${s.aiTake ? ' ' + s.aiTake : ''}`, sentiment: 0.7 },
lookAt: 'camera',
priority: 78,
};
@@ -323,7 +323,7 @@ function mintReaction(s) {
icon: '🚀💸',
emote: { trigger: 'curiosity', weight: 0.85 },
gesture: { name: 'jump', duration: 2000 },
- speak: { text: `Massive launch: $${s.symbol || 'new token'} opens with ${fmtSol(s.initialBuySol)}.`, sentiment: 0.6 },
+ speak: { text: `Massive launch: $${s.symbol || 'new token'} opens with ${fmtSol(s.initialBuySol)}.${s.aiTake ? ' ' + s.aiTake : ''}`, sentiment: 0.6 },
lookAt: 'camera',
priority: 60,
};
@@ -345,7 +345,7 @@ function mintReaction(s) {
icon: '👑',
emote: { trigger: 'curiosity', weight: 0.7 },
gesture: { name: 'wave', duration: 1500 },
- speak: { text: `Pro dev launching $${s.symbol || 'a new token'} — ${s.creatorGraduated} prior grads.`, sentiment: 0.5 },
+ speak: { text: `Pro dev launching $${s.symbol || 'a new token'} — ${s.creatorGraduated} prior grads.${s.aiTake ? ' ' + s.aiTake : ''}`, sentiment: 0.5 },
lookAt: 'camera',
priority: 45,
};
diff --git a/vercel.json b/vercel.json
index b0a6826fc..6cb05c1bb 100644
--- a/vercel.json
+++ b/vercel.json
@@ -80,6 +80,10 @@
"src": "/api/agents/solana-reputation-history",
"dest": "/api/agents/solana/[action]?action=reputation-history"
},
+ {
+ "src": "/api/agents/([^/]+)/skills-pricing",
+ "dest": "/api/agents/[id]/skills-pricing?id=$1"
+ },
{
"src": "/api/newsletter/subscribe",
"dest": "/api/newsletter-subscribe"
diff --git a/widget-studio.html b/widget-studio.html
new file mode 100644
index 000000000..1b595d622
--- /dev/null
+++ b/widget-studio.html
@@ -0,0 +1,128 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <title>Widget Studio · three.ws</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <link rel="stylesheet" href="/style.css" />
+ <link rel="stylesheet" href="/marketplace.css" />
+ <style>
+ .studio-container {
+ display: flex;
+ height: 100vh;
+ }
+ .studio-sidebar {
+ width: 300px;
+ padding: 20px;
+ background: #111;
+ color: #eee;
+ }
+ .studio-preview {
+ flex-grow: 1;
+ padding: 20px;
+ }
+ .form-group {
+ margin-bottom: 15px;
+ }
+ .form-group label {
+ display: block;
+ margin-bottom: 5px;
+ }
+ .form-group input, .form-group select {
+ width: 100%;
+ padding: 8px;
+ background: #222;
+ border: 1px solid #444;
+ color: #eee;
+ border-radius: 4px;
+ }
+ #embed-code {
+ width: 100%;
+ background: #0a0a0a;
+ color: #00ff41;
+ padding: 10px;
+ border: 1px solid #333;
+ border-radius: 4px;
+ min-height: 100px;
+ white-space: pre-wrap;
+ word-wrap: break-word;
+ }
+ </style>
+ </head>
+ <body class="market-page">
+ <div class="studio-container">
+ <aside class="studio-sidebar">
+ <h2>Widget Studio</h2>
+ <div class="form-group">
+ <label for="agent-select">Select Agent</label>
+ <select id="agent-select">
+ <!-- This would be populated dynamically -->
+ <option value="default">Default Agent</option>
+ </select>
+ </div>
+ <div class="form-group">
+ <label for="avatar-url">Avatar URL</label>
+ <input type="text" id="avatar-url" value="/default-avatar.glb" />
+ </div>
+ <div class="form-group">
+ <label for="brand-color">Brand Color</label>
+ <input type="color" id="brand-color" value="#4a9eff" />
+ </div>
+ <div class="form-group">
+ <label for="theme-select">Theme</label>
+ <select id="theme-select">
+ <option value="dark">Dark</option>
+ <option value="light">Light</option>
+ </select>
+ </div>
+ <h3>Embed Code</h3>
+ <pre id="embed-code"><code></code></pre>
+ <button id="copy-btn">Copy Code</button>
+ </aside>
+ <main class="studio-preview">
+ <iframe id="widget-preview" style="width: 100%; height: 100%; border: 1px solid #333;"></iframe>
+ </main>
+ </div>
+
+ <script>
+ const agentSelect = document.getElementById('agent-select');
+ const avatarUrlInput = document.getElementById('avatar-url');
+ const brandColorInput = document.getElementById('brand-color');
+ const themeSelect = document.getElementById('theme-select');
+ const embedCodeEl = document.getElementById('embed-code').querySelector('code');
+ const previewFrame = document.getElementById('widget-preview');
+ const copyBtn = document.getElementById('copy-btn');
+
+ function updatePreviewAndCode() {
+ const agentId = agentSelect.value;
+ const avatarUrl = avatarUrlInput.value;
+ const brandColor = brandColorInput.value;
+ const theme = themeSelect.value;
+
+ const widgetUrl = new URL('/agent-chat-widget.html', location.origin);
+ widgetUrl.searchParams.set('agentId', agentId);
+ widgetUrl.searchParams.set('avatarUrl', avatarUrl);
+ widgetUrl.searchParams.set('brandColor', brandColor);
+ widgetUrl.searchParams.set('theme', theme);
+
+ previewFrame.src = widgetUrl.href;
+
+ const embedCode = `<iframe src="${widgetUrl.href}" width="400" height="600" style="border:none;"></iframe>`;
+ embedCodeEl.textContent = embedCode;
+ }
+
+ agentSelect.addEventListener('change', updatePreviewAndCode);
+ avatarUrlInput.addEventListener('input', updatePreviewAndCode);
+ brandColorInput.addEventListener('input', updatePreviewAndCode);
+ themeSelect.addEventListener('change', updatePreviewAndCode);
+
+ copyBtn.addEventListener('click', () => {
+ navigator.clipboard.writeText(embedCodeEl.textContent);
+ copyBtn.textContent = 'Copied!';
+ setTimeout(() => { copyBtn.textContent = 'Copy Code'; }, 2000);
+ });
+
+ updatePreviewAndCode();
+ </script>
+ </body>
+</html>
diff --git a/widgets.html b/widgets.html
index da77b948a..7cd61f56c 100644
--- a/widgets.html
+++ b/widgets.html
@@ -91,6 +91,16 @@
</header>
<div class="market-body">
<div class="market-grid" id="widget-grid">
+ <div class="market-item">
+ <div class="market-item-thumb">
+ <iframe src="/agent-chat-widget.html" width="100%" height="200px" style="border:none;"></iframe>
+ </div>
+ <div class="market-item-meta">
+ <h3>3D Agent Chat</h3>
+ <p>Embed a customizable 3D agent on your site.</p>
+ <a href="/widget-studio.html" class="customize-btn">Customize & Embed</a>
+ </div>
+ </div>
<div class="market-item">
<div class="market-item-thumb">
<iframe src="/pumpfun-search.html" width="100%" height="200px" style="border:none;"></iframe>