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: billing x402, Alibaba Cloud MCP, agent tasks, and platform expansions

nirholasbf50aa87a0fc
diff --git a/STRUCTURE.md b/STRUCTURE.md
index a5364d58b..384790769 100644
--- a/STRUCTURE.md
+++ b/STRUCTURE.md
@@ -52,6 +52,7 @@ packages/avatar-agent-mcp/ → @three-ws/avatar-agent-mcp (MCP server — av
packages/pumpfun-mcp/ → @three-ws/pumpfun-mcp (MCP server — pump.fun launch tools)
packages/ibm-watsonx-mcp/ → @three-ws/ibm-watsonx-mcp (MCP server — IBM watsonx.ai)
packages/ibm-x402-mcp/ → @three-ws/ibm-x402-mcp (MCP server — IBM x402 payments)
+packages/alibaba-cloud-mcp/ → @three-ws/alibaba-cloud-mcp (MCP server — Alibaba Cloud DashScope: Qwen chat, embeddings, model discovery)
packages/three-token-mcp/ → @three-ws/three-token-mcp (MCP server — $THREE token tools)
packages/threews-avatar-mcp/ → @three-ws/threews-avatar-mcp (MCP server — three.ws avatar ops)
packages/scene-mcp/ → @three-ws/scene-mcp (MCP server — text→3D diorama scenes)
diff --git a/api/_lib/coin/three-holders.js b/api/_lib/coin/three-holders.js
index abfb00687..40a86e92e 100644
--- a/api/_lib/coin/three-holders.js
+++ b/api/_lib/coin/three-holders.js
@@ -65,9 +65,8 @@ function ensureTables() {
`;
return true;
})().catch((err) => {
- console.error('[three-holders] ensureTables failed:', err?.message || err);
_ensured = null; // allow a retry on the next call
- return false;
+ throw err; // surface the original error — callers log it in their context
});
return _ensured;
}
@@ -75,8 +74,13 @@ function ensureTables() {
/**
* Run a full $THREE holder scan and atomically refresh the snapshot table.
* Called by the cron only. Returns { holders, scannedAt } for logging.
+ *
+ * ensureTables() is preflighted here so a DB-down condition aborts BEFORE
+ * the expensive Helius DAS scan — avoiding wasted API credits every cron tick
+ * when the database is unreachable.
*/
export async function refreshThreeHolderSnapshot() {
+ await ensureTables();
const balances = await fetchHolderBalances({ mint: THREE_MINT });
return persistThreeHolderSnapshot(balances);
}
@@ -87,7 +91,7 @@ export async function refreshThreeHolderSnapshot() {
* scan for BOTH the response and self-healing the cache — never scanning twice.
*/
export async function persistThreeHolderSnapshot(balances) {
- if (!(await ensureTables())) throw new Error('three_holder_snapshot table unavailable');
+ await ensureTables();
const wallets = [...balances.keys()].filter((w) => balances.get(w) > 0n);
const now = new Date();
diff --git a/api/_lib/db.js b/api/_lib/db.js
index c6e6858ab..715e8071f 100644
--- a/api/_lib/db.js
+++ b/api/_lib/db.js
@@ -135,6 +135,34 @@ export function sqlValues(rows) {
return makeFragment(strings, values);
}
+// Returns true when the error is a Neon connectivity failure that is
+// transient and credential-level — password auth failures, TCP connection
+// refused, SSL handshake errors. These map to HTTP 503 (not 500): the server
+// is temporarily unable to service the request, not broken internally.
+// Callers should not emit per-endpoint ops alerts on these; a single
+// DB-unavailable alert per hour is enough.
+export function isDbUnavailableError(err) {
+ if (!err) return false;
+ const name = err.constructor?.name ?? '';
+ const msg = String(err.message ?? '');
+ if (name === 'NeonDbError' || name === 'DatabaseError') {
+ return (
+ msg.includes('password authentication failed') ||
+ msg.includes('connection refused') ||
+ msg.includes('ECONNREFUSED') ||
+ msg.includes('SSL connection') ||
+ msg.includes('endpoint is disabled') ||
+ msg.includes('Control plane request failed')
+ );
+ }
+ // Network-level fetch failure wrapping a Neon request (rare but happens when
+ // the Neon HTTP gateway is unreachable).
+ if (name === 'FetchError' || name === 'TypeError') {
+ return msg.includes('ECONNREFUSED') || msg.includes('fetch failed');
+ }
+ return false;
+}
+
export const sql = new Proxy(function () {}, {
apply(_t, _this, args) {
// Neon dispatches on the first argument: a string is the ordinary
diff --git a/api/_lib/forge-store.js b/api/_lib/forge-store.js
index 7ca4c91b3..b298c02f7 100644
--- a/api/_lib/forge-store.js
+++ b/api/_lib/forge-store.js
@@ -15,7 +15,7 @@
import { createHash } from 'node:crypto';
import { randomUUID } from 'node:crypto';
-import { sql } from './db.js';
+import { sql, isDbUnavailableError } from './db.js';
import { putObject, publicUrl } from './r2.js';
import { recordGenerationEvent } from './forge-events.js';
@@ -103,7 +103,8 @@ export async function createCreation({
await recordGenerationEvent({ phase: 'start', backend, tier, path, source: 'create' });
return id;
} catch (err) {
- console.error('[forge-store] createCreation failed:', err?.message);
+ if (isDbUnavailableError(err)) console.warn('[forge-store] createCreation skipped (db unavailable):', err?.message);
+ else console.error('[forge-store] createCreation failed:', err?.message);
return null;
}
}
@@ -123,7 +124,8 @@ export async function findByJob({ replicateJobId, clientKey }) {
`;
return rows[0] ?? null;
} catch (err) {
- console.error('[forge-store] findByJob failed:', err?.message);
+ if (isDbUnavailableError(err)) console.warn('[forge-store] findByJob skipped (db unavailable):', err?.message);
+ else console.error('[forge-store] findByJob failed:', err?.message);
return null;
}
}
@@ -522,7 +524,8 @@ export async function listCreations({ clientKey, limit = 24 }) {
created_at: r.created_at,
}));
} catch (err) {
- console.error('[forge-store] listCreations failed:', err?.message);
+ if (isDbUnavailableError(err)) console.warn('[forge-store] listCreations skipped (db unavailable):', err?.message);
+ else console.error('[forge-store] listCreations failed:', err?.message);
return [];
}
}
@@ -564,7 +567,8 @@ export async function listShowcase({ limit = 12 } = {}) {
created_at: r.created_at,
}));
} catch (err) {
- console.error('[forge-store] listShowcase failed:', err?.message);
+ if (isDbUnavailableError(err)) console.warn('[forge-store] listShowcase skipped (db unavailable):', err?.message);
+ else console.error('[forge-store] listShowcase failed:', err?.message);
return [];
}
}
diff --git a/api/_lib/http.js b/api/_lib/http.js
index eb0edfa25..081be0614 100644
--- a/api/_lib/http.js
+++ b/api/_lib/http.js
@@ -6,6 +6,7 @@ import { env } from './env.js';
import { captureException } from './sentry.js';
import { sendOpsAlert } from './alerts.js';
import { instrument as zauthInstrument, drain as zauthDrain } from './zauth.js';
+import { isDbUnavailableError } from './db.js';
// Secure-by-default caching: emit `no-store` UNLESS the handler already set a
// Cache-Control header (e.g. `res.setHeader('cache-control', 'public, s-maxage=…')`
@@ -378,21 +379,34 @@ export function wrap(handler) {
try {
await handler(req, res, ...rest);
} catch (err) {
- const status = err.status || 500;
+ const dbDown = isDbUnavailableError(err);
+ const status = dbDown ? 503 : (err.status || 500);
if (status >= 500) {
const ref = correlationId();
// Redact coordinates / device tokens so a 5xx on a geolocated read never
// spills the caller's position or credential to an off-box sink.
console.error(`[api] unhandled [ref ${ref}]`, err);
captureException(err, { ref, url: redactUrl(req.url), method: req.method });
- sendOpsAlert(`unhandled 5xx in ${req.method} ${redactUrl(req.url)}`, `${err?.message || String(err)}\nref ${ref}`, {
- signature: `unhandled:${redactUrl(req.url)}:${err?.message}`,
- });
+ if (dbDown) {
+ // During a DB outage every endpoint fails — fire a single shared alert
+ // rather than one per endpoint per hour to avoid alert fatigue.
+ sendOpsAlert('database unavailable', `${err?.message || String(err)}\nref ${ref}`, {
+ signature: 'db:unavailable',
+ });
+ } else {
+ sendOpsAlert(`unhandled 5xx in ${req.method} ${redactUrl(req.url)}`, `${err?.message || String(err)}\nref ${ref}`, {
+ signature: `unhandled:${redactUrl(req.url)}:${err?.message}`,
+ });
+ }
// Never echo a raw upstream message in a 5xx body — Solana/web3.js
// network errors embed the keyed RPC URL (…helius-rpc.com/?api-key=…),
// so err.message would leak HELIUS_API_KEY to the client. Hand back a
// sanitized envelope keyed to the same ref we just logged.
if (!res.headersSent && !res.writableEnded) {
+ if (dbDown) {
+ // 503 with Retry-After so clients and CDNs know to back off.
+ res.setHeader('retry-after', '30');
+ }
if (wantsHtmlNavigation(req)) {
// A human navigated into this 5xx — send them to the branded
// error page with their ref instead of a raw JSON blob. API and
@@ -400,8 +414,10 @@ export function wrap(handler) {
redirect(res, serverErrorPageLocation(ref, req), 303);
} else {
json(res, status, {
- error: err.code || 'internal_error',
- error_description: `internal error — quote ref ${ref} to support`,
+ error: dbDown ? 'service_unavailable' : (err.code || 'internal_error'),
+ error_description: dbDown
+ ? 'database temporarily unavailable — retry shortly'
+ : `internal error — quote ref ${ref} to support`,
ref,
}, { 'cache-control': 'no-store' });
}
diff --git a/api/agent-task.js b/api/agent-task.js
new file mode 100644
index 000000000..bc502b6b5
--- /dev/null
+++ b/api/agent-task.js
@@ -0,0 +1,123 @@
+// POST /api/agent-task — user queues a task for their agent
+// GET /api/agent-task?agentId=X — worker polls for its next task (bearer auth)
+//
+// Redis key: agent:task:{agentId} (LIST, LPUSH / RPOP)
+// The worker drains one task per poll; tasks stay ordered FIFO.
+//
+// POST body: { agentId: string, task: string, type?: string }
+// GET resp: { task: { text, type, ts, userId } | null }
+
+import { cors, error, json, method, rateLimited } from './_lib/http.js';
+import { getSessionUser, authenticateBearer, extractBearer } from './_lib/auth.js';
+import { limits, clientIp } from './_lib/rate-limit.js';
+import { getRedis } from './_lib/redis.js';
+import { sql } from './_lib/db.js';
+
+const TASK_KEY = (id) => `agent:task:${id}`;
+const FRAME_KEY = (id) => `agent:screen:${id}:frame`;
+const MAX_QUEUE = 20;
+const TASK_TTL = 60 * 60 * 6; // 6h — tasks expire if worker never shows up
+const TASK_MAX_LEN = 1000;
+
+export default async function handleAgentTask(req, res) {
+ if (cors(req, res, { methods: 'GET,POST,OPTIONS' })) return;
+ if (!method(req, res, ['GET', 'POST'])) return;
+
+ // ── Auth: bearer (worker) OR session (browser user) ─────────────────────
+ let userId = null;
+ const bearer = extractBearer(req);
+ if (bearer) {
+ const auth = await authenticateBearer(bearer).catch(() => null);
+ if (auth?.userId) userId = auth.userId;
+ }
+ if (!userId) {
+ const auth = await getSessionUser(req, res);
+ if (auth?.id) userId = auth.id;
+ }
+ if (!userId) return error(res, 401, 'unauthorized', 'authentication required');
+
+ const r = getRedis();
+ if (!r) return error(res, 503, 'redis_unavailable', 'task store offline');
+
+ // ── GET — worker polls for next task ─────────────────────────────────────
+ if (req.method === 'GET') {
+ const agentId = (new URL(req.url, `http://${req.headers.host || 'x'}`).searchParams.get('agentId') || '').trim();
+ if (!agentId) return error(res, 400, 'missing_agent_id', 'agentId required');
+
+ // Verify the polling identity owns this agent
+ const [agentRow] = await sql`
+ SELECT id FROM agents WHERE id = ${agentId} AND user_id = ${userId} LIMIT 1
+ `;
+ if (!agentRow) return error(res, 403, 'forbidden', 'agent not owned by this user');
+
+ // RPOP = FIFO: oldest task first
+ const raw = await r.rpop(TASK_KEY(agentId));
+ if (!raw) return json(res, 200, { task: null });
+
+ let task;
+ try {
+ task = JSON.parse(raw);
+ } catch {
+ task = { text: String(raw), type: 'general', ts: Date.now() };
+ }
+
+ return json(res, 200, { task });
+ }
+
+ // ── POST — user enqueues a task ───────────────────────────────────────────
+ if (req.method === 'POST') {
+ // Rate limit: 20 tasks/min per IP
+ const rl = await limits.apiIp(clientIp(req), { limit: 20, window: '60s' });
+ if (!rl.success) return error(res, 429, 'rate_limited', 'too many tasks — slow down');
+
+ let body;
+ try {
+ const raw = await new Promise((resolve, reject) => {
+ const chunks = [];
+ req.on('data', (c) => chunks.push(c));
+ req.on('end', () => resolve(Buffer.concat(chunks).toString('utf8')));
+ req.on('error', reject);
+ });
+ body = JSON.parse(raw);
+ } catch {
+ return error(res, 400, 'invalid_body', 'request body must be valid JSON');
+ }
+
+ const { agentId, task, type = 'general' } = body || {};
+
+ if (!agentId || typeof agentId !== 'string') {
+ return error(res, 400, 'missing_agent_id', 'agentId is required');
+ }
+ if (!task || typeof task !== 'string' || !task.trim()) {
+ return error(res, 400, 'missing_task', 'task text is required');
+ }
+
+ const text = task.trim().slice(0, TASK_MAX_LEN);
+ const taskType = ['general', 'research', 'trade', 'browse', 'monitor'].includes(type)
+ ? type : 'general';
+
+ // Verify ownership
+ const [agentRow] = await sql`
+ SELECT id, name FROM agents WHERE id = ${agentId} AND user_id = ${userId} LIMIT 1
+ `;
+ if (!agentRow) return error(res, 403, 'forbidden', 'agent not owned by this user');
+
+ const now = Date.now();
+ const record = JSON.stringify({ text, type: taskType, ts: now, userId });
+
+ // Push task to queue; trim to MAX_QUEUE
+ const len = await r.lpush(TASK_KEY(agentId), record);
+ await Promise.all([
+ r.expire(TASK_KEY(agentId), TASK_TTL),
+ len > MAX_QUEUE ? r.ltrim(TASK_KEY(agentId), 0, MAX_QUEUE - 1) : Promise.resolve(),
+ // Immediately notify the live stream so the watch panel shows the task
+ r.set(
+ FRAME_KEY(agentId),
+ JSON.stringify({ ts: now, activity: `Task queued: ${text}`, type: 'analysis' }),
+ { ex: 90 },
+ ),
+ ]);
+
+ return json(res, 200, { ok: true, queued: Math.min(len, MAX_QUEUE) });
+ }
+}
diff --git a/api/agent/caster-config.js b/api/agent/caster-config.js
new file mode 100644
index 000000000..e4138857b
--- /dev/null
+++ b/api/agent/caster-config.js
@@ -0,0 +1,99 @@
+// POST /api/agent/caster-config
+//
+// Generates a scoped API key for an agent and returns a ready-to-copy
+// .env file + Docker run command for the agent-screen-caster service.
+// The key is stored hashed — this is the only time the plaintext is returned.
+//
+// Body: { agentId: string }
+// Auth: session cookie or bearer token
+
+import { cors, json, method, readJson, wrap, error } from '../_lib/http.js';
+import { getSessionUser, authenticateBearer } from '../_lib/auth.js';
+import { sql } from '../_lib/db.js';
+
+// Mirrored from api/api-keys.js — same hashing, prefix, and storage.
+import { randomBytes, createHash } from 'crypto';
+
+const CASTER_SCOPE = 'agents:read agents:write';
+
+function randomToken(len) {
+ return randomBytes(len).toString('base64url').slice(0, len);
+}
+
+async function sha256(str) {
+ return createHash('sha256').update(str).digest('hex');
+}
+
+export default wrap(async (req, res) => {
+ if (cors(req, res, { methods: 'POST,OPTIONS', credentials: true })) return;
+ if (!method(req, res, ['POST'])) return;
+
+ const auth = await getSessionUser(req).catch(() => null)
+ || await authenticateBearer(req).catch(() => null);
+ if (!auth?.userId) return error(res, 401, 'unauthorized', 'sign in required');
+
+ const body = await readJson(req, res);
+ if (!body) return;
+ const { agentId } = body;
+ if (!agentId) return error(res, 400, 'validation_error', 'agentId required');
+
+ // Confirm the caller owns this agent.
+ const [agentRow] = await sql`
+ SELECT id, name, display_name FROM agent_identities
+ WHERE id = ${agentId} AND user_id = ${auth.userId} AND deleted_at IS NULL
+ `;
+ if (!agentRow) return error(res, 403, 'forbidden', 'not your agent');
+
+ const agentName = agentRow.name || agentRow.display_name || agentId.slice(0, 8);
+
+ // Create the API key.
+ const rawToken = `sk_live_${randomToken(32)}`;
+ const prefix = rawToken.slice(0, 14);
+ const tokenHash = await sha256(rawToken);
+ const keyName = `Screen Caster — ${agentName}`;
+
+ const [keyRow] = await sql`
+ INSERT INTO api_keys (user_id, name, token_hash, prefix, scope)
+ VALUES (${auth.userId}, ${keyName}, ${tokenHash}, ${prefix}, ${CASTER_SCOPE})
+ RETURNING id, created_at
+ `;
+
+ const envBlock = [
+ `# Screen Caster — ${agentName}`,
+ `# Generated ${new Date().toISOString()}`,
+ ``,
+ `AGENT_ID=${agentId}`,
+ `AGENT_BEARER_TOKEN=${rawToken}`,
+ `PUSH_URL=https://three.ws/api/agent/screen-push`,
+ ``,
+ `# Task: pump-monitor | trade`,
+ `TASK=pump-monitor`,
+ `# Mint to watch (pump-monitor) or JSON trade spec (trade):`,
+ `TASK_ARG=FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump`,
+ ``,
+ `FRAME_INTERVAL_MS=400`,
+ `JPEG_QUALITY=72`,
+ `HEADLESS=true`,
+ ].join('\n');
+
+ const dockerCmd = [
+ `docker run --rm \\`,
+ ` -e AGENT_ID=${agentId} \\`,
+ ` -e AGENT_BEARER_TOKEN=${rawToken} \\`,
+ ` -e PUSH_URL=https://three.ws/api/agent/screen-push \\`,
+ ` -e TASK=pump-monitor \\`,
+ ` -e TASK_ARG=FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump \\`,
+ ` three-ws/agent-screen-caster`,
+ ].join('\n');
+
+ return json(res, 200, {
+ keyId: keyRow.id,
+ prefix,
+ agentId,
+ agentName,
+ scope: CASTER_SCOPE,
+ createdAt: keyRow.created_at,
+ envBlock,
+ dockerCmd,
+ });
+});
diff --git a/api/cron/three-holders-snapshot.js b/api/cron/three-holders-snapshot.js
index d5971fb1c..ceb0cca6d 100644
--- a/api/cron/three-holders-snapshot.js
+++ b/api/cron/three-holders-snapshot.js
@@ -58,11 +58,12 @@ export default wrap(async (req, res) => {
// Never throw: a failed scan leaves the prior snapshot intact (the refresh
// only deletes inside a successful scan), so public reads are unaffected.
// A transient upstream blip — a `terminated` fetch, a Helius 429 cooldown,
- // a network reset — is expected operationally and self-heals on the next
- // 5-minute tick, so warn rather than error to keep it out of alerting;
- // reserve error for unexpected faults (a bug, a bad schema migration).
+ // a network reset, a DB auth failure — is expected operationally and
+ // self-heals on the next 5-minute tick, so warn rather than error to keep
+ // it out of alerting; reserve error for unexpected faults (a bug, a bad
+ // schema migration).
const msg = err?.message || String(err);
- const transient = /terminated|fetch failed|ECONNRESET|ETIMEDOUT|EAI_AGAIN|socket hang up|429|rate.?limit|network/i.test(msg);
+ const transient = /terminated|fetch failed|ECONNRESET|ETIMEDOUT|EAI_AGAIN|socket hang up|429|rate.?limit|network|password authentication failed|table unavailable/i.test(msg);
if (transient) console.warn('[three-holders-snapshot] refresh deferred (transient upstream):', msg);
else console.error('[three-holders-snapshot] refresh failed:', msg);
return json(res, 200, { ok: false, refreshed: false, error: msg });
diff --git a/api/galaxy/flows.js b/api/galaxy/flows.js
index 2f6a04390..4ded1232f 100644
--- a/api/galaxy/flows.js
+++ b/api/galaxy/flows.js
@@ -29,7 +29,7 @@
// GET /api/galaxy/flows?type=tips|trades|payments|launches|all
// GET /api/galaxy/flows?network=mainnet|devnet&limit=<n>
-import { sql } from '../_lib/db.js';
+import { sql, isDbUnavailableError } from '../_lib/db.js';
import { cors, json, method, rateLimited } from '../_lib/http.js';
import { limits, clientIp } from '../_lib/rate-limit.js';
import { cacheGet, cacheSet } from '../_lib/cache.js';
@@ -285,7 +285,9 @@ export default async function handler(req, res) {
return json(res, 200, { data: body });
} catch (e) {
const timedOut = e instanceof FeedDeadline;
- console.error('[api/galaxy/flows] failed', timedOut ? 'soft-deadline' : e?.message, timedOut ? '' : e?.stack);
+ const dbDown = !timedOut && isDbUnavailableError(e);
+ if (dbDown) console.warn('[api/galaxy/flows] degraded (db unavailable):', e?.message);
+ else console.error('[api/galaxy/flows] failed', timedOut ? 'soft-deadline' : e?.message, timedOut ? '' : e?.stack);
// Degrade gracefully: a delta poll (`since`) returns nothing new rather than
// erroring the live map; any view falls back to its last-good snapshot when
// one exists, else an empty window. All are valid 200s.
diff --git a/api/pump/intel.js b/api/pump/intel.js
index 13184e7fa..4a3f50dda 100644
--- a/api/pump/intel.js
+++ b/api/pump/intel.js
@@ -19,7 +19,7 @@
// yet, so the dashboard can render its "engine warming up" state instead of 500ing.
import { cors, json, method, wrap } from '../_lib/http.js';
-import { sql } from '../_lib/db.js';
+import { sql, isDbUnavailableError } from '../_lib/db.js';
const LAMPORTS_PER_SOL = 1_000_000_000;
@@ -465,7 +465,8 @@ export default wrap(async (req, res) => {
return json(res, 200, { view, network, degraded: true, reason: 'engine_tables_pending', ts: Date.now() },
{ 'cache-control': 'no-store' });
}
- console.error('[pump/intel] query failed', err);
+ if (isDbUnavailableError(err)) console.warn('[pump/intel] db unavailable:', err?.message);
+ else console.error('[pump/intel] query failed', err);
return json(res, 200, { view, network, degraded: true, reason: 'query_failed', ts: Date.now() },
{ 'cache-control': 'no-store' });
}
diff --git a/api/user/x402-subscriptions.js b/api/user/x402-subscriptions.js
new file mode 100644
index 000000000..13b9b90be
--- /dev/null
+++ b/api/user/x402-subscriptions.js
@@ -0,0 +1,209 @@
+// GET /api/user/x402-subscriptions
+// Lists the signed-in user's x402 subscription keys (the credential an AWS
+// Marketplace customer is issued, and any native subscription created on
+// their behalf). Returns prefixes and usage only — never the secret.
+//
+// POST /api/user/x402-subscriptions
+// body { action: 'rotate' | 'revoke', id: '<subscriptionId>' }
+// rotate — revoke the old key and mint a fresh one. The new plaintext is
+// returned ONCE. For AWS-Marketplace-sourced keys this goes
+// through the billing bridge so the new key stays linked to the
+// AWS CustomerIdentifier and keeps metering correctly.
+// revoke — permanently disable a NATIVE key. AWS-sourced keys cannot be
+// bare-revoked here (that would cut off access the customer is
+// paying AWS for); cancellation must originate in AWS Marketplace.
+// Rotate them instead.
+//
+// Auth: session cookie (matches the sibling /api/aws-marketplace/* endpoints).
+
+import { cors, json, readJson, wrap, method } from '../_lib/http.js';
+import { sql } from '../_lib/db.js';
+import { getSessionUser } from '../_lib/auth.js';
+import { createSubscription, revokeSubscription } from '../_lib/x402/api-keys.js';
+import {
+ issueSubscriptionForCustomer,
+ revokeSubscriptionForCustomer,
+} from '../_lib/aws-marketplace-bridge.js';
+
+const AWS_SOURCE = 'aws-marketplace';
+
+function deriveStatus(row) {
+ if (row.revoked_at) return 'revoked';
+ if (row.expires_at && new Date(row.expires_at).getTime() <= Date.now()) return 'expired';
+ return 'active';
+}
+
+function shape(row) {
+ const meta = row.meta || {};
+ return {
+ id: row.id,
+ name: row.name,
+ keyPrefix: row.key_prefix,
+ rateLimitPerMinute: row.rate_limit_per_minute,
+ status: deriveStatus(row),
+ source: meta.source === AWS_SOURCE ? AWS_SOURCE : 'native',
+ isFreeTrial: Boolean(meta.is_free_trial),
+ createdAt: row.created_at,
+ expiresAt: row.expires_at,
+ usage: {
+ granted: Number(row.granted || 0),
+ denied: Number(row.denied || 0),
+ lastSeenAt: row.last_seen || null,
+ },
+ };
+}
+
+export default wrap(async (req, res) => {
+ if (cors(req, res, { methods: 'GET,POST,OPTIONS', credentials: true })) return;
+ if (!method(req, res, ['GET', 'POST'])) return;
+
+ let user;
+ try {
+ user = await getSessionUser(req);
+ } catch {
+ return json(res, 401, { error: 'unauthenticated' });
+ }
+ if (!user) return json(res, 401, { error: 'unauthenticated' });
+
+ if (req.method === 'GET') {
+ const rows = await sql`
+ SELECT s.id, s.name, s.key_prefix, s.rate_limit_per_minute,
+ s.expires_at, s.revoked_at, s.meta, s.created_at,
+ u.granted, u.denied, u.last_seen
+ FROM x402_subscriptions s
+ LEFT JOIN LATERAL (
+ SELECT count(*) FILTER (WHERE granted) AS granted,
+ count(*) FILTER (WHERE NOT granted) AS denied,
+ max(created_at) AS last_seen
+ FROM x402_access_log
+ WHERE caller_id = 'subscription:' || s.id
+ ) u ON true
+ WHERE s.created_by = ${user.id}
+ ORDER BY s.created_at DESC
+ `;
+ return json(res, 200, { subscriptions: rows.map(shape) });
+ }
+
+ // POST — rotate or revoke
+ let body;
+ try {
+ body = await readJson(req);
+ } catch {
+ return json(res, 400, { error: 'invalid_json' });
+ }
+
+ const action = body?.action;
+ const id = body?.id;
+ if (action !== 'rotate' && action !== 'revoke') {
+ return json(res, 400, { error: 'invalid_action' });
+ }
+ if (!id || typeof id !== 'string') {
+ return json(res, 400, { error: 'missing_id' });
+ }
+
+ // Ownership check — never act on a subscription the caller doesn't own.
+ const [sub] = await sql`
+ SELECT id, name, rate_limit_per_minute, expires_at, revoked_at, meta, created_by
+ FROM x402_subscriptions
+ WHERE id = ${id}
+ `;
+ if (!sub || sub.created_by !== user.id) {
+ return json(res, 404, { error: 'subscription_not_found' });
+ }
+
+ const meta = sub.meta || {};
+ const isAws = meta.source === AWS_SOURCE;
+
+ if (action === 'revoke') {
+ if (isAws) {
+ return json(res, 409, {
+ error: 'aws_revoke_not_allowed',
+ message:
+ 'This key bills through AWS Marketplace. Cancel the subscription in AWS Marketplace to stop billing, or rotate the key to replace it.',
+ });
+ }
+ await revokeSubscription(id);
+ return json(res, 200, { ok: true, action: 'revoke', id });
+ }
+
+ // rotate
+ if (isAws) {
+ const customerId = meta.aws_customer_identifier;
+ if (!customerId) {
+ return json(res, 422, { error: 'aws_customer_unresolved' });
+ }
+ const [customer] = await sql`
+ SELECT customer_identifier, product_code, offer_id, is_free_trial,
+ subscription_status, user_id
+ FROM aws_marketplace_customers
+ WHERE customer_identifier = ${customerId}
+ `;
+ if (!customer) return json(res, 404, { error: 'customer_not_found' });
+ if (
+ customer.subscription_status === 'cancelled' ||
+ customer.subscription_status === 'expired'
+ ) {
+ return json(res, 409, {
+ error: 'subscription_inactive',
+ status: customer.subscription_status,
+ message:
+ 'Your AWS Marketplace subscription is no longer active. Re-subscribe in AWS Marketplace to issue a new key.',
+ });
+ }
+
+ // Revoke the prior link, then mint a fresh key through the bridge so the
+ // new key stays attached to the AWS CustomerIdentifier and keeps metering.
+ await revokeSubscriptionForCustomer(customerId);
+ let issued;
+ try {
+ issued = await issueSubscriptionForCustomer({
+ customer_identifier: customer.customer_identifier,
+ product_code: customer.product_code,
+ offer_id: customer.offer_id,
+ is_free_trial: customer.is_free_trial,
+ user_id: customer.user_id || user.id,
+ });
+ } catch (err) {
+ console.error('[user/x402-subscriptions] aws rotate failed', { customerId, error: err?.message });
+ return json(res, 502, { error: 'rotate_failed' });
+ }
+ return json(res, 200, {
+ ok: true,
+ action: 'rotate',
+ source: AWS_SOURCE,
+ subscription: {
+ id: issued.subscriptionId,
+ keyPrefix: issued.keyPrefix,
+ token: issued.token,
+ rateLimitPerMinute: issued.rateLimitPerMinute,
+ },
+ });
+ }
+
+ // Native rotate — revoke old, mint a replacement carrying the same shape.
+ await revokeSubscription(id);
+ let created;
+ try {
+ created = await createSubscription({
+ name: sub.name,
+ rateLimitPerMinute: sub.rate_limit_per_minute,
+ expiresAt: sub.expires_at,
+ meta: sub.meta,
+ createdBy: user.id,
+ });
+ } catch (err) {
+ console.error('[user/x402-subscriptions] native rotate failed', { id, error: err?.message });
+ return json(res, 502, { error: 'rotate_failed' });
+ }
+ return json(res, 200, {
+ ok: true,
+ action: 'rotate',
+ source: 'native',
+ subscription: {
+ id: created.id,
+ keyPrefix: created.key_prefix,
+ token: created.token,
+ rateLimitPerMinute: created.rate_limit_per_minute,
+ },
+ });
+});
diff --git a/blog/three-ws-alibaba-cloud-partnership.html b/blog/three-ws-alibaba-cloud-partnership.html
new file mode 100644
index 000000000..62baf00d3
--- /dev/null
+++ b/blog/three-ws-alibaba-cloud-partnership.html
@@ -0,0 +1,144 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>three.ws Joins the Alibaba Cloud Partner Network</title>
+ <meta name="description" content="three.ws is now an Alibaba Cloud Partner, bringing Qwen foundation models and Asia-Pacific cloud infrastructure to the three.ws 3D AI agent platform.">
+ <meta name="keywords" content="three.ws, Alibaba Cloud, DashScope, Qwen, Qwen-Max, partner network, AI agents, 3D agents, on-chain agents, Asia-Pacific">
+ <link rel="canonical" href="https://three.ws/blog/three-ws-alibaba-cloud-partnership">
+
+ <meta property="og:title" content="three.ws Joins the Alibaba Cloud Partner Network">
+ <meta property="og:description" content="Qwen foundation models and Asia-Pacific infrastructure join the three.ws agent platform. three.ws is now an Alibaba Cloud Partner.">
+ <meta property="og:url" content="https://three.ws/blog/three-ws-alibaba-cloud-partnership">
+ <meta property="og:type" content="article">
+
+ <meta name="twitter:card" content="summary_large_image">
+ <meta name="twitter:title" content="three.ws Joins the Alibaba Cloud Partner Network">
+ <meta name="twitter:description" content="Qwen models and Alibaba Cloud infrastructure come to three.ws 3D AI agents.">
+
+ <link rel="shortcut icon" href="/favicon.ico">
+ <link rel="stylesheet" href="/nav.css">
+ <link rel="stylesheet" href="/footer.css">
+ <style>
+ :root { color-scheme: dark; }
+ body { margin: 0; background: #060611; color: #e7e7f5; font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
+ .post-wrap { max-width: 720px; margin: 0 auto; padding: 96px 24px 80px; }
+ .post-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: #7a85a8; font-size: 13px; margin-bottom: 28px; }
+ .post-date { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
+ .post-tag { padding: 2px 8px; border-radius: 999px; background: rgba(255,106,0,.08); color: #ff8c40; font-size: 11px; font-weight: 500; letter-spacing: 0.02em; text-transform: uppercase; }
+ h1 { font-size: clamp(26px, 4vw, 40px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; margin: 0 0 20px; }
+ h2 { font-size: 20px; font-weight: 600; margin: 40px 0 12px; letter-spacing: -0.01em; }
+ p { color: #c8c8e0; line-height: 1.7; margin: 0 0 18px; font-size: 16px; }
+ ul, ol { color: #c8c8e0; line-height: 1.7; margin: 0 0 18px; padding-left: 24px; font-size: 16px; }
+ li { margin-bottom: 6px; }
+ a { color: #ff8c40; text-decoration: none; }
+ a:hover { text-decoration: underline; }
+ code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: rgba(255,106,0,.07); color: #ff8c40; padding: 2px 6px; border-radius: 4px; }
+ strong { color: #e7e7f5; }
+ .post-back { display: inline-flex; align-items: center; gap: 6px; color: #7a85a8; font-size: 14px; margin-bottom: 40px; text-decoration: none; }
+ .post-back:hover { color: #ff8c40; }
+ hr { border: none; border-top: 1px solid rgba(255,255,255,.08); margin: 40px 0; }
+
+ .model-table { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 14px; }
+ .model-table th { text-align: left; color: #7a85a8; font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,.06); }
+ .model-table td { padding: 10px 12px; color: #c8c8e0; border-bottom: 1px solid rgba(255,255,255,.04); vertical-align: top; }
+ .model-table tr:last-child td { border-bottom: none; }
+ .model-table td:first-child { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: #ff8c40; font-size: 13px; }
+
+ .cmd-block { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); border-radius: 10px; padding: 16px 18px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: #c8c8e0; overflow-x: auto; margin: 0 0 20px; }
+ .cmd-block .comment { color: #4a5270; }
+ </style>
+ <meta property="og:image" content="https://three.ws/og-image.png">
+ <meta property="og:image:width" content="1200">
+ <meta property="og:image:height" content="630">
+ <meta name="twitter:image" content="https://three.ws/og-image.png">
+ <script type="application/ld+json">{"@context":"https://schema.org","@type":"BlogPosting","headline":"three.ws Joins the Alibaba Cloud Partner Network","description":"three.ws is now an Alibaba Cloud Partner, bringing Qwen foundation models and Asia-Pacific cloud infrastructure to the three.ws 3D AI agent platform.","image":"https://three.ws/og-image.png","datePublished":"2026-06-27T12:00:00.000Z","dateModified":"2026-06-27T12:00:00.000Z","author":{"@type":"Organization","name":"three.ws","url":"https://three.ws"},"publisher":{"@type":"Organization","name":"three.ws","url":"https://three.ws","logo":{"@type":"ImageObject","url":"https://three.ws/og-image.png"}},"mainEntityOfPage":{"@type":"WebPage","@id":"https://three.ws/blog/three-ws-alibaba-cloud-partnership"},"keywords":"three.ws, Alibaba Cloud, DashScope, Qwen, partner network, AI agents, 3D agents"}</script>
+ <script type="application/ld+json">{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://three.ws/"},{"@type":"ListItem","position":2,"name":"Blog","item":"https://three.ws/blog"},{"@type":"ListItem","position":3,"name":"three.ws Joins the Alibaba Cloud Partner Network","item":"https://three.ws/blog/three-ws-alibaba-cloud-partnership"}]}</script>
+</head>
+<body>
+ <div id="nav-container"></div>
+ <main class="post-wrap">
+ <a class="post-back" href="/blog">&larr; Blog</a>
+ <div class="post-meta">
+ <span class="post-date">2026-06-27</span>
+ <span class="post-tag">Partnership</span>
+ <span class="post-tag">Alibaba Cloud</span>
+ <span class="post-tag">AI</span>
+ </div>
+ <h1>three.ws Joins the Alibaba Cloud Partner Network</h1>
+
+ <p><strong>three.ws is now an Alibaba Cloud Partner.</strong> The platform has been enrolled in the Alibaba Cloud Partner Network, bringing Alibaba's Qwen family of foundation models and Asia-Pacific cloud infrastructure to the three.ws 3D AI agent platform.</p>
+
+ <h2>What this adds to three.ws</h2>
+ <p>three.ws agents choose their brain. Today that brain can be Claude, GPT-4o, IBM Granite, or any model the builder selects. The Alibaba Cloud partnership adds the Qwen family to that list &mdash; one of the strongest open-weight model lines in the world, with standout performance on multilingual, long-context, and coding tasks.</p>
+
+ <p>Qwen models are available immediately via the <a href="https://www.npmjs.com/package/@three-ws/alibaba-cloud-mcp" rel="noopener noreferrer">@three-ws/alibaba-cloud-mcp</a> MCP server, published to npm and the MCP Registry under <code>io.github.nirholas/alibaba-cloud</code>. Wire any Qwen model into Claude Code, Cursor, or any MCP-compatible agent in one command:</p>
+
+ <div class="cmd-block"><span class="comment"># Add Alibaba Cloud DashScope to Claude Code</span>
+claude mcp add alibaba-cloud \
+ -e DASHSCOPE_API_KEY=sk-... \
+ -- npx -y @three-ws/alibaba-cloud-mcp</div>
+
+ <h2>The Qwen model lineup</h2>
+ <p>DashScope exposes the full Qwen family through an OpenAI-compatible API, so any agent that knows how to call GPT can call Qwen with a single line change. The MCP server defaults to <code>qwen-plus</code> and supports the following models out of the box:</p>
+
+ <table class="model-table">
+ <thead>
+ <tr>
+ <th>Model</th>
+ <th>Strengths</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>qwen-max</td>
+ <td>Highest quality &mdash; complex reasoning, long documents, nuanced tasks</td>
+ </tr>
+ <tr>
+ <td>qwen-plus</td>
+ <td>Balanced performance and cost &mdash; the default for most agent workflows</td>
+ </tr>
+ <tr>
+ <td>qwen-turbo</td>
+ <td>Fastest and cheapest &mdash; high-throughput pipelines and simple completions</td>
+ </tr>
+ <tr>
+ <td>qwen-long</td>
+ <td>Up to 1 million tokens of context &mdash; whole codebases, large documents</td>
+ </tr>
+ <tr>
+ <td>text-embedding-v3</td>
+ <td>Text embeddings (64&ndash;2048 dimensions) for search, RAG, and clustering</td>
+ </tr>
+ </tbody>
+ </table>
+
+ <h2>Asia-Pacific reach</h2>
+ <p>three.ws agents are embedded across storefronts, DeFi dashboards, and interactive sites worldwide. Alibaba Cloud's global edge network &mdash; with particular density across East Asia, Southeast Asia, and Australia &mdash; closes the latency gap for users and agents in the APAC region. The DashScope API is available on both international (<code>dashscope-intl.aliyuncs.com</code>) and China-region (<code>dashscope.aliyuncs.com</code>) endpoints, configurable with a single environment variable.</p>
+
+ <h2>What ships today</h2>
+ <ul>
+ <li><strong>@three-ws/alibaba-cloud-mcp</strong> &mdash; production-ready MCP server with <code>qwen_chat</code>, <code>qwen_embed</code>, and <code>qwen_list_models</code> tools. No intermediary backend; your <code>DASHSCOPE_API_KEY</code> talks directly to DashScope.</li>
+ <li><strong>International and China endpoints</strong> &mdash; set <code>DASHSCOPE_REGION=cn</code> or <code>DASHSCOPE_BASE_URL</code> for custom routing.</li>
+ <li><strong>Full model selection</strong> &mdash; override the default model per call with any Qwen model id.</li>
+ </ul>
+
+ <h2>Get your DashScope API key</h2>
+ <p>Create a free Alibaba Cloud account at <a href="https://www.alibabacloud.com" rel="noopener noreferrer">alibabacloud.com</a>, navigate to <strong>Bailian Console &rarr; API Keys</strong>, and generate a key. Paste it into the <code>DASHSCOPE_API_KEY</code> environment variable and the MCP server connects immediately.</p>
+
+ <h2>Links</h2>
+ <ul>
+ <li>npm: <a href="https://www.npmjs.com/package/@three-ws/alibaba-cloud-mcp" rel="noopener noreferrer">@three-ws/alibaba-cloud-mcp</a></li>
+ <li>Partner ecosystem: <a href="https://three.ws/partners">three.ws/partners</a></li>
+ <li>Open source: <a href="https://github.com/nirholas/three.ws" rel="noopener noreferrer">github.com/nirholas/three.ws</a></li>
+ <li>Platform: <a href="https://three.ws">three.ws</a></li>
+ </ul>
+
+ <hr>
+ <p><a href="/blog">&larr; All posts</a></p>
+ </main>
+ <div id="footer-container"></div>
+ <script src="/nav.js"></script>
+</body>
+</html>
diff --git a/package.json b/package.json
index a7407dd22..347238513 100644
--- a/package.json
+++ b/package.json
@@ -79,7 +79,8 @@
"packages/tutor-mcp",
"packages/loom-mcp",
"walk-sdk",
- "tour-sdk"
+ "tour-sdk",
+ "packages/alibaba-cloud-mcp"
],
"main": "src/app.js",
"browserslist": [
diff --git a/packages/alibaba-cloud-mcp/LICENSE b/packages/alibaba-cloud-mcp/LICENSE
new file mode 100644
index 000000000..8e2251ab4
--- /dev/null
+++ b/packages/alibaba-cloud-mcp/LICENSE
@@ -0,0 +1,180 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship made available under
+ the License, as indicated by a copyright notice that is included in
+ or attached to the work (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other transformations
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
+ in the Work by the copyright owner or by an individual or Legal Entity
+ authorized to submit on behalf of the copyright owner. For the purposes
+ of this definition, "submitted" means any form of electronic, verbal,
+ or written communication sent to the Licensor or its representatives,
+ including but not limited to communication on electronic mailing lists,
+ source code control systems, and issue tracking systems that are managed
+ by, or on behalf of, the Licensor for the purpose of discussing and
+ improving the Work, but excluding communication that is conspicuously
+ marked or designated in writing by the copyright owner as "Not a
+ Contribution."
+
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
+ whom a Contribution has been received by the Licensor and included
+ within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by the combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a cross-claim
+ or counterclaim in a lawsuit) alleging that the Work or any
+ Contribution embodied within the Work constitutes direct or contributory
+ patent infringement, then any patent licenses granted to You under
+ this License for that Work shall terminate as of the date such
+ litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or Derivative
+ Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, You must include a readable copy of the
+ attribution notices contained within such NOTICE file, in
+ at least one of the following places: within a NOTICE text
+ file distributed as part of the Derivative Works; within
+ the Source form or documentation, if provided along with the
+ Derivative Works; or, within a display generated by the
+ Derivative Works, if and wherever such third-party notices
+ normally appear. The contents of the NOTICE file are for
+ informational purposes only and do not modify the License.
+ You may add Your own attribution notices within Derivative
+ Works that You distribute, alongside or in addition to the
+ NOTICE text from the Work, provided that such additional
+ attribution notices cannot be construed as modifying the License.
+
+ You may add Your own license statement for Your modifications and
+ may provide additional grant of rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the
+ Derivative Works, and to permit persons to whom the Derivative Works
+ are furnished to do so.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or reproducing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or exemplary damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or all other
+ commercial damages or losses), even if such Contributor has been
+ advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may offer only
+ conditions consistent with this License.
+
+ END OF TERMS AND CONDITIONS
+
+ Copyright 2026 nirholas
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/packages/alibaba-cloud-mcp/README.md b/packages/alibaba-cloud-mcp/README.md
new file mode 100644
index 000000000..4059748be
--- /dev/null
+++ b/packages/alibaba-cloud-mcp/README.md
@@ -0,0 +1,109 @@
+<p align="center">
+ <a href="https://three.ws"><img src="https://three.ws/three-ws-mcp-icon.svg" alt="three.ws" width="88" height="88"></a>
+</p>
+
+<h1 align="center">@three-ws/alibaba-cloud-mcp</h1>
+
+<p align="center"><strong>MCP server for Alibaba Cloud DashScope — Qwen chat, embeddings, and model discovery on your own account.</strong></p>
+
+<p align="center">
+ <a href="https://www.npmjs.com/package/@three-ws/alibaba-cloud-mcp"><img alt="npm" src="https://img.shields.io/npm/v/@three-ws/alibaba-cloud-mcp?logo=npm&color=cb3837"></a>
+ <img alt="license" src="https://img.shields.io/npm/l/@three-ws/alibaba-cloud-mcp?color=3b82f6">
+ <img alt="node" src="https://img.shields.io/node/v/@three-ws/alibaba-cloud-mcp?color=339933&logo=node.js">
+ <a href="https://three.ws"><img alt="three.ws" src="https://img.shields.io/badge/built%20by-three.ws-000"></a>
+</p>
+
+<p align="center">
+ <a href="#install">Install</a> ·
+ <a href="#quick-start">Quick start</a> ·
+ <a href="#tools">Tools</a> ·
+ <a href="#models">Models</a> ·
+ <a href="https://three.ws">three.ws</a>
+</p>
+
+---
+
+> A [Model Context Protocol](https://modelcontextprotocol.io) server that exposes Alibaba Cloud's Qwen models — and anything else in your DashScope account — to MCP clients such as Claude Desktop, Claude Code, and Cursor. It talks **directly** to the DashScope OpenAI-compatible REST API with **your own Alibaba Cloud API key**: no intermediary backend, no telemetry, no mock data.
+
+> Community-built and not affiliated with Alibaba Cloud. Registry name: `io.github.nirholas/alibaba-cloud`.
+
+## Install
+
+```bash
+npm install @three-ws/alibaba-cloud-mcp
+```
+
+Run it directly with `npx` (no install needed):
+
+```bash
+DASHSCOPE_API_KEY=sk-... npx @three-ws/alibaba-cloud-mcp
+```
+
+## Quick start
+
+With Claude Code, one command:
+
+```bash
+claude mcp add alibaba-cloud -e DASHSCOPE_API_KEY=sk-... -- npx -y @three-ws/alibaba-cloud-mcp
+```
+
+Or add the server to your MCP client config:
+
+```json
+{
+ "mcpServers": {
+ "alibaba-cloud": {
+ "command": "npx",
+ "args": ["-y", "@three-ws/alibaba-cloud-mcp"],
+ "env": {
+ "DASHSCOPE_API_KEY": "sk-..."
+ }
+ }
+ }
+}
+```
+
+## Requirements
+
+1. An [Alibaba Cloud account](https://www.alibabacloud.com/)
+2. A [DashScope API key](https://bailian.console.alibabacloud.com/) — navigate to **API Keys** and create one
+3. Node.js ≥ 20
+
+## Tools
+
+| Tool | Description |
+|---|---|
+| `qwen_chat` | Chat completion with any Qwen model (qwen-max, qwen-plus, qwen-turbo, qwen-long) |
+| `qwen_embed` | Text embeddings via text-embedding-v3 (1024-dim default, up to 2048) |
+| `qwen_list_models` | List all models available on this DashScope account |
+
+## Models
+
+| Model ID | Use |
+|---|---|
+| `qwen-max` | Highest quality — complex reasoning, long documents |
+| `qwen-plus` | Balanced performance (default) |
+| `qwen-turbo` | Fastest and cheapest — simple tasks |
+| `qwen-long` | Long context (up to 1M tokens) |
+| `text-embedding-v3` | Embeddings, semantic search, RAG (default) |
+
+## Environment variables
+
+| Variable | Required | Default | Description |
+|---|---|---|---|
+| `DASHSCOPE_API_KEY` | **yes** | — | Your DashScope API key |
+| `DASHSCOPE_MODEL_ID` | no | `qwen-plus` | Default chat model |
+| `DASHSCOPE_EMBED_MODEL_ID` | no | `text-embedding-v3` | Default embedding model |
+| `DASHSCOPE_BASE_URL` | no | International endpoint | Custom DashScope endpoint |
+| `DASHSCOPE_REGION` | no | — | Set to `cn` for the China endpoint |
+| `DASHSCOPE_TIMEOUT_MS` | no | `60000` | Request timeout in ms |
+
+## Inspect
+
+```bash
+npx -y @modelcontextprotocol/inspector npx @three-ws/alibaba-cloud-mcp
+```
+
+---
+
+Built by [three.ws](https://three.ws) · [three.ws/blog/three-ws-alibaba-cloud-partnership](https://three.ws/blog/three-ws-alibaba-cloud-partnership)
diff --git a/packages/alibaba-cloud-mcp/package.json b/packages/alibaba-cloud-mcp/package.json
new file mode 100644
index 000000000..54edb8997
--- /dev/null
+++ b/packages/alibaba-cloud-mcp/package.json
@@ -0,0 +1,60 @@
+{
+ "name": "@three-ws/alibaba-cloud-mcp",
+ "version": "0.1.0",
+ "description": "MCP server for Alibaba Cloud DashScope by three.ws — Qwen chat, embeddings, and model discovery using your own Alibaba Cloud API key.",
+ "type": "module",
+ "author": "nirholas",
+ "license": "Apache-2.0",
+ "homepage": "https://three.ws",
+ "mcpName": "io.github.nirholas/alibaba-cloud",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/nirholas/three.ws.git",
+ "directory": "packages/alibaba-cloud-mcp"
+ },
+ "bugs": {
+ "url": "https://github.com/nirholas/three.ws/issues"
+ },
+ "keywords": [
+ "mcp",
+ "model-context-protocol",
+ "alibaba",
+ "alibaba-cloud",
+ "dashscope",
+ "qwen",
+ "qwen-max",
+ "qwen-plus",
+ "qwen-turbo",
+ "llm",
+ "embeddings",
+ "ai-agent",
+ "three.ws"
+ ],
+ "publishConfig": {
+ "access": "public"
+ },
+ "files": [
+ "src",
+ "server.json",
+ "README.md",
+ "LICENSE"
+ ],
+ "bin": {
+ "alibaba-cloud-mcp": "src/index.js"
+ },
+ "main": "./src/index.js",
+ "exports": {
+ ".": "./src/index.js"
+ },
+ "engines": {
+ "node": ">=20"
+ },
+ "scripts": {
+ "start": "node src/index.js",
+ "test": "node --test \"test/**/*.test.mjs\"",
+ "inspect": "npx -y @modelcontextprotocol/inspector node src/index.js"
+ },
+ "dependencies": {
+ "@modelcontextprotocol/sdk": "^1.29.0"
+ }
+}
diff --git a/packages/alibaba-cloud-mcp/server.json b/packages/alibaba-cloud-mcp/server.json
new file mode 100644
index 000000000..59d956ff3
--- /dev/null
+++ b/packages/alibaba-cloud-mcp/server.json
@@ -0,0 +1,64 @@
+{
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
+ "name": "io.github.nirholas/alibaba-cloud",
+ "title": "Alibaba Cloud DashScope — Qwen",
+ "description": "Alibaba Cloud DashScope MCP by three.ws: Qwen chat, embeddings, and model discovery on your own account.",
+ "websiteUrl": "https://three.ws",
+ "icons": [
+ {
+ "src": "https://three.ws/three-ws-mcp-icon.svg",
+ "mimeType": "image/svg+xml",
+ "sizes": ["any"]
+ }
+ ],
+ "repository": {
+ "url": "https://github.com/nirholas/three.ws",
+ "source": "github",
+ "subfolder": "packages/alibaba-cloud-mcp"
+ },
+ "version": "0.1.0",
+ "packages": [
+ {
+ "registryType": "npm",
+ "identifier": "@three-ws/alibaba-cloud-mcp",
+ "version": "0.1.0",
+ "runtimeHint": "npx",
+ "transport": {
+ "type": "stdio"
+ },
+ "environmentVariables": [
+ {
+ "name": "DASHSCOPE_API_KEY",
+ "description": "DashScope API key. Create one at https://bailian.console.alibabacloud.com/ → API Keys.",
+ "isRequired": true,
+ "isSecret": true,
+ "format": "string"
+ },
+ {
+ "name": "DASHSCOPE_MODEL_ID",
+ "description": "Default chat model id. Options: qwen-max, qwen-plus (default), qwen-turbo, qwen-long.",
+ "isRequired": false,
+ "format": "string"
+ },
+ {
+ "name": "DASHSCOPE_EMBED_MODEL_ID",
+ "description": "Default embedding model id. Defaults to text-embedding-v3.",
+ "isRequired": false,
+ "format": "string"
+ },
+ {
+ "name": "DASHSCOPE_BASE_URL",
+ "description": "Custom DashScope endpoint. Defaults to international (dashscope-intl.aliyuncs.com).",
+ "isRequired": false,
+ "format": "string"
+ },
+ {
+ "name": "DASHSCOPE_REGION",
+ "description": "Set to 'cn' to use the China endpoint (dashscope.aliyuncs.com). Ignored if DASHSCOPE_BASE_URL is set.",
+ "isRequired": false,
+ "format": "string"
+ }
+ ]
+ }
+ ]
+}
diff --git a/packages/alibaba-cloud-mcp/src/dashscope.js b/packages/alibaba-cloud-mcp/src/dashscope.js
new file mode 100644
index 000000000..37cf6ca3a
--- /dev/null
+++ b/packages/alibaba-cloud-mcp/src/dashscope.js
@@ -0,0 +1,170 @@
+// Alibaba Cloud DashScope REST client.
+//
+// A thin, dependency-free wrapper over the DashScope OpenAI-compatible API.
+// DashScope exposes Qwen models (and others) through an OpenAI-compatible
+// endpoint, so authentication is a simple bearer token — no IAM dance needed.
+//
+// International endpoint: https://dashscope-intl.aliyuncs.com/compatible-mode/v1
+// China endpoint: https://dashscope.aliyuncs.com/compatible-mode/v1
+//
+// Every method calls a real DashScope endpoint. There is no mock path — a
+// missing credential or upstream failure surfaces as a thrown DashScopeError.
+
+export const INTL_BASE_URL = 'https://dashscope-intl.aliyuncs.com/compatible-mode/v1';
+export const CN_BASE_URL = 'https://dashscope.aliyuncs.com/compatible-mode/v1';
+
+export class DashScopeError extends Error {
+ constructor(message, { status, detail } = {}) {
+ super(message);
+ this.name = 'DashScopeError';
+ this.status = status;
+ this.detail = detail;
+ }
+}
+
+export function loadConfig(env = process.env) {
+ const apiKey = env.DASHSCOPE_API_KEY?.trim();
+ if (!apiKey) {
+ throw new DashScopeError(
+ 'DASHSCOPE_API_KEY is not set. Create an API key at ' +
+ 'https://bailian.console.alibabacloud.com/ → API Keys and export it as DASHSCOPE_API_KEY.',
+ );
+ }
+
+ const baseUrl = (
+ env.DASHSCOPE_BASE_URL?.trim() ||
+ (env.DASHSCOPE_REGION === 'cn' ? CN_BASE_URL : INTL_BASE_URL)
+ ).replace(/\/$/, '');
+
+ return {
+ apiKey,
+ baseUrl,
+ chatModel: env.DASHSCOPE_MODEL_ID?.trim() || 'qwen-plus',
+ embedModel: env.DASHSCOPE_EMBED_MODEL_ID?.trim() || 'text-embedding-v3',
+ timeoutMs: Number(env.DASHSCOPE_TIMEOUT_MS) || 60_000,
+ };
+}
+
+export class DashScopeClient {
+ constructor(config) {
+ this.config = config;
+ }
+
+ async _fetch(url, init) {
+ const controller = new AbortController();
+ const timer = setTimeout(() => controller.abort(), this.config.timeoutMs);
+ try {
+ return await fetch(url, { ...init, signal: controller.signal });
+ } catch (err) {
+ if (err.name === 'AbortError') {
+ throw new DashScopeError(
+ `Request to ${url} timed out after ${this.config.timeoutMs}ms.`,
+ );
+ }
+ throw new DashScopeError(`Network error calling ${url}: ${err.message}`);
+ } finally {
+ clearTimeout(timer);
+ }
+ }
+
+ async _json(res) {
+ const text = await res.text();
+ if (!text) return {};
+ try {
+ return JSON.parse(text);
+ } catch {
+ return { _raw: text };
+ }
+ }
+
+ async _post(path, payload) {
+ const res = await this._fetch(`${this.config.baseUrl}${path}`, {
+ method: 'POST',
+ headers: {
+ authorization: `Bearer ${this.config.apiKey}`,
+ 'content-type': 'application/json',
+ accept: 'application/json',
+ },
+ body: JSON.stringify(payload),
+ });
+ const data = await this._json(res);
+ if (!res.ok) throw this._upstreamError(res.status, data);
+ return data;
+ }
+
+ async _get(path) {
+ const res = await this._fetch(`${this.config.baseUrl}${path}`, {
+ method: 'GET',
+ headers: {
+ authorization: `Bearer ${this.config.apiKey}`,
+ accept: 'application/json',
+ },
+ });
+ const data = await this._json(res);
+ if (!res.ok) throw this._upstreamError(res.status, data);
+ return data;
+ }
+
+ _upstreamError(status, data) {
+ const message =
+ data?.error?.message ||
+ data?.message ||
+ data?._raw ||
+ 'DashScope request failed';
+ return new DashScopeError(`DashScope error (${status}): ${message}`, {
+ status,
+ detail: data?.error?.code || data?.error?.type,
+ });
+ }
+
+ // Chat completion. messages is an array of { role, content }.
+ async chat(messages, { model, maxTokens, temperature, topP } = {}) {
+ const body = {
+ model: model || this.config.chatModel,
+ messages,
+ };
+ if (maxTokens != null || temperature != null || topP != null) {
+ body.max_tokens = maxTokens;
+ if (temperature != null) body.temperature = temperature;
+ if (topP != null) body.top_p = topP;
+ }
+ const data = await this._post('/chat/completions', body);
+ const choice = data.choices?.[0];
+ return {
+ text: choice?.message?.content ?? '',
+ finishReason: choice?.finish_reason,
+ usage: data.usage,
+ model: data.model || body.model,
+ };
+ }
+
+ // Text embeddings for one or more input strings.
+ async embed(inputs, { model, dimensions } = {}) {
+ const body = {
+ model: model || this.config.embedModel,
+ input: Array.isArray(inputs) ? inputs : [inputs],
+ encoding_format: 'float',
+ };
+ if (dimensions) body.dimensions = dimensions;
+ const data = await this._post('/embeddings', body);
+ const sorted = (data.data || []).sort((a, b) => a.index - b.index);
+ return {
+ model: data.model || body.model,
+ vectors: sorted.map((d) => d.embedding),
+ inputCount: sorted.length,
+ dimensions: sorted[0]?.embedding?.length ?? 0,
+ usage: data.usage,
+ };
+ }
+
+ // List models available on this account.
+ async listModels() {
+ const data = await this._get('/models');
+ return (data.data || []).map((m) => ({
+ id: m.id,
+ object: m.object,
+ owned_by: m.owned_by,
+ created: m.created,
+ }));
+ }
+}
diff --git a/packages/alibaba-cloud-mcp/src/index.js b/packages/alibaba-cloud-mcp/src/index.js
new file mode 100644
index 000000000..5ea42c61c
--- /dev/null
+++ b/packages/alibaba-cloud-mcp/src/index.js
@@ -0,0 +1,113 @@
+#!/usr/bin/env node
+// @three-ws/alibaba-cloud-mcp — stdio MCP server for Alibaba Cloud DashScope.
+//
+// Exposes Qwen models (and other DashScope models) as MCP tools:
+// chat, embeddings, and model discovery over the OpenAI-compatible DashScope API.
+//
+// Architecture: this process talks DIRECTLY to the DashScope REST API using
+// YOUR Alibaba Cloud API key. No intermediary backend, no mock path — all
+// data comes from DashScope. Configure via environment variables:
+//
+// DASHSCOPE_API_KEY (required) DashScope API key
+// → https://bailian.console.alibabacloud.com/ → API Keys
+// DASHSCOPE_MODEL_ID (optional) default chat model, default qwen-plus
+// DASHSCOPE_EMBED_MODEL_ID(optional) default embedding model, default text-embedding-v3
+// DASHSCOPE_BASE_URL (optional) custom endpoint, defaults to international
+// DASHSCOPE_REGION (optional) set to "cn" to use China endpoint
+// DASHSCOPE_TIMEOUT_MS (optional) request timeout, default 60000
+//
+// Run standalone:
+// DASHSCOPE_API_KEY=... npx @three-ws/alibaba-cloud-mcp
+//
+// Inspect:
+// npx -y @modelcontextprotocol/inspector npx @three-ws/alibaba-cloud-mcp
+
+import { createRequire } from 'node:module';
+import { realpathSync } from 'node:fs';
+import { pathToFileURL } from 'node:url';
+
+import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
+import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
+
+import { loadConfig, DashScopeClient, DashScopeError } from './dashscope.js';
+import { buildTools } from './tools.js';
+
+const require = createRequire(import.meta.url);
+const { version: PKG_VERSION } = require('../package.json');
+
+export function buildServer() {
+ const config = loadConfig();
+ const client = new DashScopeClient(config);
+ const tools = buildTools(client);
+
+ const server = new McpServer(
+ {
+ name: 'alibaba-cloud-mcp',
+ title: 'Alibaba Cloud DashScope',
+ version: PKG_VERSION,
+ },
+ {
+ capabilities: { tools: {} },
+ instructions:
+ 'three.ws Alibaba Cloud MCP — Qwen models and DashScope AI via your own ' +
+ 'Alibaba Cloud API key. qwen_chat for conversation and reasoning, ' +
+ 'qwen_embed for text embeddings and semantic search, ' +
+ 'qwen_list_models to discover available models. ' +
+ 'Set DASHSCOPE_API_KEY to your DashScope key. ' +
+ 'Defaults: qwen-plus (chat), text-embedding-v3 (embeddings). ' +
+ 'Use qwen-max for highest quality, qwen-turbo for lowest latency.',
+ },
+ );
+
+ for (const tool of tools) {
+ server.tool(
+ tool.definition.name,
+ tool.definition.description,
+ tool.definition.inputSchema.properties,
+ async (args) => {
+ try {
+ return await tool.handler(args);
+ } catch (err) {
+ if (err instanceof DashScopeError) {
+ return {
+ isError: true,
+ content: [
+ {
+ type: 'text',
+ text: `DashScope error: ${err.message}${err.detail ? ` (${err.detail})` : ''}`,
+ },
+ ],
+ };
+ }
+ throw err;
+ }
+ },
+ );
+ }
+
+ return server;
+}
+
+async function main() {
+ let config;
+ try {
+ config = loadConfig();
+ } catch (err) {
+ process.stderr.write(`[alibaba-cloud-mcp] configuration error: ${err.message}\n`);
+ process.exit(1);
+ return;
+ }
+
+ const server = buildServer();
+ const transport = new StdioServerTransport();
+ await server.connect(transport);
+ process.stderr.write(
+ `[alibaba-cloud-mcp] v${PKG_VERSION} running — model: ${config.chatModel}, endpoint: ${config.baseUrl}\n`,
+ );
+}
+
+const isMain =
+ process.argv[1] &&
+ realpathSync(process.argv[1]) === realpathSync(pathToFileURL(import.meta.url).pathname);
+
+if (isMain) main();
diff --git a/packages/alibaba-cloud-mcp/src/tools.js b/packages/alibaba-cloud-mcp/src/tools.js
new file mode 100644
index 000000000..e457351b5
--- /dev/null
+++ b/packages/alibaba-cloud-mcp/src/tools.js
@@ -0,0 +1,171 @@
+// MCP tool definitions for the Alibaba Cloud DashScope MCP server.
+//
+// Each entry pairs an MCP tool definition (name + JSON-Schema input) with a
+// handler that maps validated arguments onto a DashScopeClient call. Handlers
+// trust their inputs (the schema is the boundary) and let DashScopeError
+// propagate — the server maps those to MCP tool errors with the upstream cause.
+
+const generativeAnnotations = {
+ readOnlyHint: true,
+ openWorldHint: true,
+ idempotentHint: false,
+};
+const deterministicAnnotations = {
+ readOnlyHint: true,
+ openWorldHint: true,
+ idempotentHint: true,
+};
+
+function jsonResult(structured, summary) {
+ const text = summary
+ ? `${summary}\n\n${JSON.stringify(structured, null, 2)}`
+ : JSON.stringify(structured, null, 2);
+ return { content: [{ type: 'text', text }], structuredContent: structured };
+}
+
+const samplingProps = {
+ max_tokens: {
+ type: 'integer',
+ minimum: 1,
+ maximum: 32768,
+ description: 'Maximum tokens to generate.',
+ },
+ temperature: {
+ type: 'number',
+ minimum: 0,
+ maximum: 2,
+ description: 'Sampling temperature. 0 is greedy/deterministic.',
+ },
+ top_p: {
+ type: 'number',
+ minimum: 0,
+ maximum: 1,
+ description: 'Nucleus sampling probability mass.',
+ },
+};
+
+export function buildTools(client) {
+ return [
+ {
+ definition: {
+ name: 'qwen_chat',
+ title: 'Qwen Chat',
+ annotations: generativeAnnotations,
+ description:
+ 'Chat completion with an Alibaba Cloud Qwen model via DashScope. ' +
+ 'Pass a list of role/content messages and get the assistant reply plus ' +
+ 'token usage. Defaults to qwen-plus; use qwen-max for highest quality, ' +
+ 'qwen-turbo for fastest/cheapest, or qwen-long for very large contexts.',
+ inputSchema: {
+ type: 'object',
+ properties: {
+ messages: {
+ type: 'array',
+ minItems: 1,
+ description: 'Conversation so far, oldest first.',
+ items: {
+ type: 'object',
+ properties: {
+ role: {
+ type: 'string',
+ enum: ['system', 'user', 'assistant'],
+ },
+ content: { type: 'string' },
+ },
+ required: ['role', 'content'],
+ },
+ },
+ model: {
+ type: 'string',
+ description:
+ 'Override the model id. Options: qwen-max, qwen-plus (default), ' +
+ 'qwen-turbo, qwen-long, qwen-max-latest.',
+ },
+ ...samplingProps,
+ },
+ required: ['messages'],
+ },
+ },
+ handler: async (args) => {
+ const result = await client.chat(args.messages, {
+ model: args.model,
+ maxTokens: args.max_tokens,
+ temperature: args.temperature,
+ topP: args.top_p,
+ });
+ return jsonResult(result, result.text);
+ },
+ },
+
+ {
+ definition: {
+ name: 'qwen_embed',
+ title: 'Qwen Text Embeddings',
+ annotations: deterministicAnnotations,
+ description:
+ 'Generate text embeddings using Alibaba Cloud text-embedding models. ' +
+ 'Returns a float vector per input string. Useful for semantic search, ' +
+ 'clustering, and RAG retrieval. Defaults to text-embedding-v3 (1024-dim).',
+ inputSchema: {
+ type: 'object',
+ properties: {
+ inputs: {
+ oneOf: [
+ { type: 'string' },
+ { type: 'array', items: { type: 'string' }, minItems: 1 },
+ ],
+ description: 'One string or an array of strings to embed.',
+ },
+ model: {
+ type: 'string',
+ description:
+ 'Embedding model id (default: text-embedding-v3). ' +
+ 'Alternatives: text-embedding-v2, text-embedding-async-v3.',
+ },
+ dimensions: {
+ type: 'integer',
+ minimum: 64,
+ maximum: 2048,
+ description:
+ 'Output vector dimensions. text-embedding-v3 supports 64–2048 (default 1024).',
+ },
+ },
+ required: ['inputs'],
+ },
+ },
+ handler: async (args) => {
+ const inputs = Array.isArray(args.inputs) ? args.inputs : [args.inputs];
+ const result = await client.embed(inputs, {
+ model: args.model,
+ dimensions: args.dimensions,
+ });
+ return jsonResult(
+ result,
+ `Embedded ${result.inputCount} string(s) with ${result.model} → ${result.dimensions}-dim vectors.`,
+ );
+ },
+ },
+
+ {
+ definition: {
+ name: 'qwen_list_models',
+ title: 'List DashScope Models',
+ annotations: deterministicAnnotations,
+ description:
+ 'List the models available on this DashScope account. ' +
+ 'Returns model ids, owners, and creation timestamps.',
+ inputSchema: {
+ type: 'object',
+ properties: {},
+ },
+ },
+ handler: async () => {
+ const models = await client.listModels();
+ return jsonResult(
+ { count: models.length, models },
+ `${models.length} models available on this DashScope account.`,
+ );
+ },
+ },
+ ];
+}
diff --git a/packages/alibaba-cloud-mcp/test/dashscope.test.mjs b/packages/alibaba-cloud-mcp/test/dashscope.test.mjs
new file mode 100644
index 000000000..8284a2b15
--- /dev/null
+++ b/packages/alibaba-cloud-mcp/test/dashscope.test.mjs
@@ -0,0 +1,59 @@
+import { describe, it } from 'node:test';
+import assert from 'node:assert/strict';
+
+import { loadConfig, DashScopeClient, DashScopeError, INTL_BASE_URL, CN_BASE_URL } from '../src/dashscope.js';
+
+describe('loadConfig', () => {
+ it('throws if DASHSCOPE_API_KEY is absent', () => {
+ assert.throws(() => loadConfig({}), (err) => {
+ assert(err instanceof DashScopeError);
+ assert(err.message.includes('DASHSCOPE_API_KEY'));
+ return true;
+ });
+ });
+
+ it('uses international endpoint by default', () => {
+ const cfg = loadConfig({ DASHSCOPE_API_KEY: 'test-key' });
+ assert.equal(cfg.baseUrl, INTL_BASE_URL);
+ });
+
+ it('uses China endpoint when DASHSCOPE_REGION=cn', () => {
+ const cfg = loadConfig({ DASHSCOPE_API_KEY: 'test-key', DASHSCOPE_REGION: 'cn' });
+ assert.equal(cfg.baseUrl, CN_BASE_URL);
+ });
+
+ it('honours DASHSCOPE_BASE_URL override', () => {
+ const cfg = loadConfig({ DASHSCOPE_API_KEY: 'test-key', DASHSCOPE_BASE_URL: 'https://custom.example.com/v1' });
+ assert.equal(cfg.baseUrl, 'https://custom.example.com/v1');
+ });
+
+ it('strips trailing slash from base URL', () => {
+ const cfg = loadConfig({ DASHSCOPE_API_KEY: 'test-key', DASHSCOPE_BASE_URL: 'https://custom.example.com/v1/' });
+ assert.equal(cfg.baseUrl, 'https://custom.example.com/v1');
+ });
+
+ it('defaults to qwen-plus and text-embedding-v3', () => {
+ const cfg = loadConfig({ DASHSCOPE_API_KEY: 'test-key' });
+ assert.equal(cfg.chatModel, 'qwen-plus');
+ assert.equal(cfg.embedModel, 'text-embedding-v3');
+ });
+
+ it('respects model overrides', () => {
+ const cfg = loadConfig({
+ DASHSCOPE_API_KEY: 'test-key',
+ DASHSCOPE_MODEL_ID: 'qwen-max',
+ DASHSCOPE_EMBED_MODEL_ID: 'text-embedding-v2',
+ });
+ assert.equal(cfg.chatModel, 'qwen-max');
+ assert.equal(cfg.embedModel, 'text-embedding-v2');
+ });
+});
+
+describe('DashScopeError', () => {
+ it('carries status and detail', () => {
+ const err = new DashScopeError('test error', { status: 401, detail: 'invalid_api_key' });
+ assert.equal(err.name, 'DashScopeError');
+ assert.equal(err.status, 401);
+ assert.equal(err.detail, 'invalid_api_key');
+ });
+});
diff --git a/pages/agent-screen.html b/pages/agent-screen.html
index 2cecb320c..8b71c1ccb 100644
--- a/pages/agent-screen.html
+++ b/pages/agent-screen.html
@@ -344,7 +344,7 @@
.asc-activity-icon { font-size: 0.9rem; flex: none; }
#asc-current-activity { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
- /* ── no-agent state ── */
+ /* ── no-agent / setup state ── */
.asc-no-agent {
flex: 1;
display: flex;
@@ -374,17 +374,409 @@
}
.asc-no-agent a:hover { opacity: 0.88; }
+ /* ── Worker Setup panel ── */
+ .ws-setup {
+ flex: 1;
+ overflow-y: auto;
+ padding: 2.5rem 1rem 3rem;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ animation: asc-fadein 0.3s ease both;
+ }
+ .ws-setup-inner {
+ width: 100%;
+ max-width: 680px;
+ display: flex;
+ flex-direction: column;
+ gap: 1.5rem;
+ }
+ .ws-setup-hero {
+ text-align: center;
+ margin-bottom: 0.5rem;
+ }
+ .ws-setup-hero h1 {
+ margin: 0 0 0.5rem;
+ font-size: 1.6rem;
+ font-weight: 760;
+ color: #eef2fa;
+ letter-spacing: -0.03em;
+ background: linear-gradient(135deg, #fff 30%, #8a9fff);
+ -webkit-background-clip: text;
+ -webkit-text-fill-color: transparent;
+ background-clip: text;
+ }
+ .ws-setup-hero p {
+ margin: 0;
+ color: rgba(255,255,255,0.45);
+ font-size: 0.9rem;
+ line-height: 1.55;
+ }
+ .ws-setup-step {
+ background: rgba(255,255,255,0.035);
+ border: 1px solid rgba(255,255,255,0.08);
+ border-radius: 14px;
+ overflow: hidden;
+ }
+ .ws-setup-step-head {
+ display: flex;
+ align-items: center;
+ gap: 0.75rem;
+ padding: 0.95rem 1.1rem;
+ border-bottom: 1px solid rgba(255,255,255,0.07);
+ }
+ .ws-step-num {
+ width: 26px;
+ height: 26px;
+ border-radius: 50%;
+ background: rgba(91,143,255,0.18);
+ border: 1.5px solid rgba(91,143,255,0.4);
+ color: #7aabff;
+ font-size: 0.78rem;
+ font-weight: 760;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ flex: none;
+ }
+ .ws-step-num.done {
+ background: rgba(61,220,132,0.15);
+ border-color: rgba(61,220,132,0.4);
+ color: #3ddc84;
+ }
+ .ws-setup-step-head h3 {
+ margin: 0;
+ font-size: 0.92rem;
+ font-weight: 680;
+ color: #dce6ff;
+ letter-spacing: -0.01em;
+ }
+ .ws-setup-step-head p {
+ margin: 0;
+ font-size: 0.8rem;
+ color: rgba(255,255,255,0.4);
+ }
+ .ws-setup-step-body { padding: 1.1rem; }
+
+ /* agent picker */
+ .ws-agent-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
+ gap: 0.65rem;
+ }
+ .ws-agent-card {
+ display: flex;
+ align-items: center;
+ gap: 0.65rem;
+ padding: 0.65rem 0.8rem;
+ border-radius: 10px;
+ border: 1.5px solid rgba(255,255,255,0.09);
+ background: rgba(255,255,255,0.04);
+ cursor: pointer;
+ transition: border-color 0.15s, background 0.15s;
+ text-align: left;
+ }
+ .ws-agent-card:hover { border-color: rgba(91,143,255,0.35); background: rgba(91,143,255,0.07); }
+ .ws-agent-card.selected { border-color: #5b8fff; background: rgba(91,143,255,0.12); }
+ .ws-agent-avatar {
+ width: 36px;
+ height: 36px;
+ border-radius: 8px;
+ object-fit: cover;
+ flex: none;
+ background: rgba(91,143,255,0.15);
+ border: 1px solid rgba(91,143,255,0.2);
+ }
+ .ws-agent-avatar-placeholder {
+ width: 36px;
+ height: 36px;
+ border-radius: 8px;
+ flex: none;
+ background: linear-gradient(135deg, rgba(91,143,255,0.2), rgba(130,96,255,0.2));
+ border: 1px solid rgba(91,143,255,0.2);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 1rem;
+ }
+ .ws-agent-info { min-width: 0; }
+ .ws-agent-name {
+ font-size: 0.82rem;
+ font-weight: 660;
+ color: #dce6ff;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+ .ws-agent-uuid {
+ font-size: 0.7rem;
+ color: rgba(255,255,255,0.3);
+ font-family: monospace;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+ .ws-agent-empty {
+ color: rgba(255,255,255,0.35);
+ font-size: 0.85rem;
+ padding: 1rem 0;
+ text-align: center;
+ }
+ .ws-agent-empty a { color: #7aabff; }
+
+ /* API key area */
+ .ws-key-row {
+ display: flex;
+ gap: 0.65rem;
+ align-items: center;
+ }
+ .ws-key-display {
+ flex: 1;
+ background: rgba(0,0,0,0.3);
+ border: 1px solid rgba(255,255,255,0.1);
+ border-radius: 8px;
+ padding: 0.6rem 0.85rem;
+ font-family: 'Courier New', monospace;
+ font-size: 0.8rem;
+ color: #a8c2ff;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ min-width: 0;
+ }
+ .ws-key-display.placeholder { color: rgba(255,255,255,0.2); font-style: italic; font-family: inherit; }
+ .ws-btn {
+ appearance: none;
+ border: none;
+ border-radius: 9px;
+ padding: 0.55rem 1rem;
+ font: inherit;
+ font-size: 0.82rem;
+ font-weight: 660;
+ cursor: pointer;
+ transition: opacity 0.15s, transform 0.1s;
+ white-space: nowrap;
+ flex: none;
+ }
+ .ws-btn:active { transform: scale(0.97); }
+ .ws-btn-primary {
+ background: linear-gradient(135deg, #4a7fff, #8260ff);
+ color: #fff;
+ }
+ .ws-btn-primary:hover { opacity: 0.88; }
+ .ws-btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
+ .ws-btn-ghost {
+ background: rgba(255,255,255,0.07);
+ border: 1px solid rgba(255,255,255,0.12);
+ color: rgba(255,255,255,0.7);
+ }
+ .ws-btn-ghost:hover { background: rgba(255,255,255,0.11); color: #fff; }
+ .ws-btn-copy {
+ background: rgba(255,255,255,0.07);
+ border: 1px solid rgba(255,255,255,0.12);
+ color: rgba(255,255,255,0.6);
+ padding: 0.55rem 0.75rem;
+ border-radius: 8px;
+ font-size: 0.8rem;
+ }
+ .ws-btn-copy.copied { background: rgba(61,220,132,0.12); border-color: rgba(61,220,132,0.3); color: #3ddc84; }
+ .ws-key-note {
+ font-size: 0.78rem;
+ color: rgba(255,255,255,0.35);
+ margin-top: 0.6rem;
+ line-height: 1.5;
+ }
+ .ws-key-note strong { color: rgba(255,200,80,0.8); }
+
+ /* Command block */
+ .ws-cmd-tabs {
+ display: flex;
+ gap: 0.4rem;
+ margin-bottom: 0.8rem;
+ }
+ .ws-cmd-tab {
+ appearance: none;
+ border: 1px solid rgba(255,255,255,0.1);
+ background: rgba(255,255,255,0.04);
+ color: rgba(255,255,255,0.5);
+ border-radius: 7px;
+ padding: 0.3rem 0.7rem;
+ font: inherit;
+ font-size: 0.78rem;
+ font-weight: 640;
+ cursor: pointer;
+ transition: all 0.15s;
+ }
+ .ws-cmd-tab.active {
+ background: rgba(91,143,255,0.15);
+ border-color: rgba(91,143,255,0.4);
+ color: #8aabff;
+ }
+ .ws-cmd-block {
+ position: relative;
+ background: rgba(0,0,0,0.4);
+ border: 1px solid rgba(255,255,255,0.09);
+ border-radius: 10px;
+ padding: 1rem 1rem 1rem 1.1rem;
+ }
+ .ws-cmd-copy {
+ position: absolute;
+ top: 0.6rem;
+ right: 0.6rem;
+ }
+ .ws-cmd-block pre {
+ margin: 0;
+ font-family: 'Courier New', monospace;
+ font-size: 0.78rem;
+ line-height: 1.65;
+ color: #c5d5ff;
+ overflow-x: auto;
+ white-space: pre;
+ padding-right: 3rem;
+ }
+ .ws-cmd-block pre .cmd-comment { color: rgba(255,255,255,0.3); }
+ .ws-cmd-block pre .cmd-key { color: #7aabff; }
+ .ws-cmd-block pre .cmd-val { color: #a8e6cf; }
+ .ws-cmd-block pre .cmd-run { color: #ffcc66; }
+ .ws-cmd-block pre .cmd-dim { color: rgba(255,255,255,0.25); }
+
+ .ws-status-ok {
+ display: flex;
+ align-items: center;
+ gap: 0.5rem;
+ font-size: 0.82rem;
+ color: #3ddc84;
+ margin-top: 0.9rem;
+ padding: 0.55rem 0.85rem;
+ background: rgba(61,220,132,0.08);
+ border: 1px solid rgba(61,220,132,0.2);
+ border-radius: 8px;
+ }
+ .ws-watch-link {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.45rem;
+ margin-top: 0.75rem;
+ background: linear-gradient(135deg, #4a7fff, #8260ff);
+ color: #fff;
+ border-radius: 9px;
+ padding: 0.6rem 1.2rem;
+ font-size: 0.88rem;
+ font-weight: 660;
+ text-decoration: none;
+ transition: opacity 0.15s;
+ width: fit-content;
+ }
+ .ws-watch-link:hover { opacity: 0.88; }
+ .ws-not-signed-in {
+ display: flex;
+ align-items: center;
+ gap: 0.6rem;
+ font-size: 0.85rem;
+ color: rgba(255,255,255,0.5);
+ padding: 0.8rem 1rem;
+ background: rgba(255,200,80,0.06);
+ border: 1px solid rgba(255,200,80,0.15);
+ border-radius: 8px;
+ }
+ .ws-not-signed-in a { color: #ffcc66; }
+ .ws-spinner {
+ display: inline-block;
+ width: 14px;
+ height: 14px;
+ border: 2px solid rgba(91,143,255,0.3);
+ border-top-color: #5b8fff;
+ border-radius: 50%;
+ animation: ws-spin 0.7s linear infinite;
+ flex: none;
+ }
+ @keyframes ws-spin { to { transform: rotate(360deg); } }
+
/* ── animations ── */
@keyframes asc-pulse { 0%,100%{opacity:1}50%{opacity:0.35} }
@keyframes asc-ring { 0%{transform:scale(1);opacity:0.8}100%{transform:scale(1.6);opacity:0} }
@keyframes asc-inner { 0%{opacity:0.5}100%{opacity:0} }
@keyframes asc-fadein { from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none} }
+ /* ── task input bar ── */
+ .asc-task-bar {
+ flex: none;
+ border-top: 1px solid rgba(255,255,255,0.06);
+ background: rgba(4, 6, 15, 0.95);
+ backdrop-filter: blur(8px);
+ padding: 0.6rem 0.8rem;
+ display: flex;
+ flex-direction: column;
+ gap: 0.35rem;
+ }
+ .asc-task-form {
+ display: flex;
+ align-items: center;
+ gap: 0.55rem;
+ background: rgba(255,255,255,0.04);
+ border: 1px solid rgba(255,255,255,0.1);
+ border-radius: 10px;
+ padding: 0.45rem 0.55rem 0.45rem 0.7rem;
+ transition: border-color 0.15s, box-shadow 0.15s;
+ }
+ .asc-task-form:focus-within {
+ border-color: rgba(91,143,255,0.55);
+ box-shadow: 0 0 0 3px rgba(91,143,255,0.12);
+ }
+ .asc-task-icon {
+ color: rgba(91,143,255,0.6);
+ font-size: 0.72rem;
+ flex: none;
+ user-select: none;
+ }
+ .asc-task-input {
+ flex: 1;
+ min-width: 0;
+ background: transparent;
+ border: none;
+ outline: none;
+ color: rgba(255,255,255,0.9);
+ font: inherit;
+ font-size: 0.85rem;
+ caret-color: #5b8fff;
+ }
+ .asc-task-input::placeholder { color: rgba(255,255,255,0.28); }
+ .asc-task-input:disabled { opacity: 0.5; }
+ .asc-task-send {
+ flex: none;
+ appearance: none;
+ border: none;
+ background: linear-gradient(135deg, #4a7fff, #8260ff);
+ color: #fff;
+ border-radius: 7px;
+ width: 30px;
+ height: 30px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ cursor: pointer;
+ transition: opacity 0.15s, transform 0.1s;
+ }
+ .asc-task-send:hover { opacity: 0.88; }
+ .asc-task-send:active { transform: scale(0.93); }
+ .asc-task-send:disabled { opacity: 0.35; cursor: not-allowed; }
+ .asc-task-send.sending { opacity: 0.6; animation: asc-pulse 0.8s ease-in-out infinite; }
+ .asc-task-status {
+ font-size: 0.75rem;
+ min-height: 1rem;
+ padding-left: 0.2rem;
+ color: rgba(255,255,255,0.4);
+ transition: opacity 0.2s;
+ }
+ .asc-task-status.ok { color: var(--screen-live); }
+ .asc-task-status.err { color: #ff6b6b; }
+
/* ── fullscreen mode ── */
.asc-screen-panel:fullscreen { background: #000; }
.asc-screen-panel:fullscreen .asc-screen-label { display: none; }
.asc-screen-panel:fullscreen .asc-screen-wrap { align-items: stretch; }
.asc-screen-panel:fullscreen #asc-screen-canvas { max-height: 100%; border-radius: 0; }
+ .asc-screen-panel:fullscreen .asc-task-bar { display: none; }
/* ── responsive ── */
@media (max-width: 700px) {
@@ -417,9 +809,7 @@
<div class="asc-main" id="asc-main">
<!-- populated by agent-screen.js -->
<div id="asc-no-agent" class="asc-no-agent" style="display:flex">
- <h2>No agent selected</h2>
- <p>Open this page from an agent's profile to watch them work in real time.</p>
- <a href="/agents">Browse agents →</a>
+ <div class="ws-spinner"></div>
</div>
</div>
diff --git a/pages/aws-marketplace/welcome.html b/pages/aws-marketplace/welcome.html
index bb47a85f8..932f2b1ea 100644
--- a/pages/aws-marketplace/welcome.html
+++ b/pages/aws-marketplace/welcome.html
@@ -185,7 +185,7 @@
<p class="sub" id="linked-sub">Your AWS Marketplace subscription is linked to your three.ws account. Use the API key below to call any x402 endpoint — no on-chain payment required.</p>
<div id="already-issued-note" class="already-issued" style="display:none">
- Your API key was issued during a previous activation. For security we don't store the plaintext — manage and rotate it from <a href="/dashboard/api" style="color:inherit;text-decoration:underline">API keys</a>.
+ Your API key was issued during a previous activation. For security we don't store the plaintext — manage and rotate it from <a href="/billing/keys" style="color:inherit;text-decoration:underline">API keys</a>.
</div>
<div id="key-panel" class="key-panel" style="display:none">
@@ -194,7 +194,7 @@
<button type="button" class="copy" id="btn-copy-key">Copy</button>
</div>
<div class="key-value" id="key-value"></div>
- <div class="key-note">Store this somewhere safe — it's shown once and grants every paid call on your AWS subscription. You can rotate it any time from <a href="/dashboard/api" style="color:inherit;text-decoration:underline">API keys</a>.</div>
+ <div class="key-note">Store this somewhere safe — it's shown once and grants every paid call on your AWS subscription. You can rotate it any time from <a href="/billing/keys" style="color:inherit;text-decoration:underline">API keys</a>.</div>
</div>
<div class="usage">
@@ -204,7 +204,7 @@
</div>
<div class="linked-actions">
- <a href="/dashboard/api" class="btn btn-sec">Manage keys</a>
+ <a href="/billing/keys" class="btn btn-sec">Manage keys</a>
<a href="/dashboard" class="btn">Dashboard</a>
</div>
</div>
diff --git a/pages/billing/keys.html b/pages/billing/keys.html
new file mode 100644
index 000000000..6a4a5afc4
--- /dev/null
+++ b/pages/billing/keys.html
@@ -0,0 +1,151 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <style>/* three.ws hidden-guard — make the `hidden` attribute authoritative; see scripts/lib/hidden-guard.mjs */[hidden]{display:none!important}</style>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
+ <title>API keys &amp; usage · three.ws</title>
+ <meta name="robots" content="noindex" />
+ <link rel="icon" href="/favicon.ico" />
+ <style>
+ :root { color-scheme: dark; --accent:#ffffff; --border:#222222; --bg:#000000; --panel:#141414; --panel2:#0a0a0a; --text:#e8e8f0; --muted:#888888; --green:#22c55e; --yellow:#f59e0b; --red:#ef4444; --aws:#FF9900; }
+ * { box-sizing: border-box; margin: 0; padding: 0; }
+ body { font: 15px/1.6 -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
+ header { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 16px; }
+ header a.back { color: #aaa; text-decoration: none; font-size: 14px; }
+ header a.back:hover { color: var(--text); }
+ .wrap { max-width: 760px; margin: 0 auto; padding: 48px 24px 96px; width: 100%; }
+
+ h1 { font-size: clamp(24px, 4vw, 32px); letter-spacing: -0.025em; line-height: 1.1; font-weight: 600; margin-bottom: 10px; }
+ .lead { color: var(--muted); font-size: 15px; margin-bottom: 36px; max-width: 560px; }
+ .lead a { color: var(--text); }
+
+ .state { display: none; }
+ .state.active { display: block; }
+
+ /* loading */
+ #state-loading { text-align: center; padding-top: 56px; }
+ .spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; margin: 0 auto 18px; }
+ @keyframes spin { to { transform: rotate(360deg); } }
+ #state-loading p { color: var(--muted); font-size: 14px; }
+
+ .skeleton { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; height: 132px; margin-bottom: 16px; position: relative; overflow: hidden; }
+ .skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent); transform: translateX(-100%); animation: shimmer 1.4s infinite; }
+ @keyframes shimmer { to { transform: translateX(100%); } }
+
+ /* card */
+ .card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 20px 22px; margin-bottom: 16px; transition: border-color 0.15s; }
+ .card:hover { border-color: #2e2e2e; }
+ .card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
+ .card-name { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
+ .badges { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
+
+ .badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; padding: 3px 10px; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; border: 1px solid var(--border); color: var(--muted); }
+ .badge.aws { color: var(--aws); border-color: rgba(255,153,0,0.35); background: rgba(255,153,0,0.06); }
+ .badge.native { color: #c9c9d6; }
+ .badge.trial { color: var(--yellow); border-color: rgba(245,158,11,0.35); background: rgba(245,158,11,0.06); }
+
+ .pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; padding: 4px 11px; font-size: 12px; font-weight: 600; }
+ .pill .dot { width: 7px; height: 7px; border-radius: 50%; }
+ .pill.active { color: var(--green); background: rgba(34,197,94,0.1); } .pill.active .dot { background: var(--green); }
+ .pill.revoked { color: var(--muted); background: rgba(136,136,136,0.12); } .pill.revoked .dot { background: var(--muted); }
+ .pill.expired { color: var(--yellow); background: rgba(245,158,11,0.1); } .pill.expired .dot { background: var(--yellow); }
+
+ .meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 14px 20px; padding: 16px 0; border-top: 1px solid #1c1c1c; }
+ .meta-grid .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 3px; }
+ .meta-grid .value { font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }
+ .key-prefix { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; font-size: 13px; color: #cfcfdc; }
+
+ .card-actions { display: flex; gap: 8px; padding-top: 16px; border-top: 1px solid #1c1c1c; flex-wrap: wrap; }
+ .btn { border-radius: 9px; border: 1px solid var(--border); background: var(--panel2); color: var(--text); font-size: 13px; font-weight: 500; padding: 8px 14px; cursor: pointer; transition: background 0.15s, border-color 0.15s, opacity 0.15s; }
+ .btn:hover:not(:disabled) { background: rgba(255,255,255,0.04); border-color: #333; }
+ .btn:disabled { opacity: 0.45; cursor: not-allowed; }
+ .btn.primary { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }
+ .btn.primary:hover:not(:disabled) { filter: brightness(0.92); background: var(--accent); }
+ .btn.danger { color: var(--red); border-color: rgba(239,68,68,0.3); }
+ .btn.danger:hover:not(:disabled) { background: rgba(239,68,68,0.1); }
+ .btn.ghost { background: transparent; }
+
+ /* freshly minted key reveal */
+ .reveal { margin-top: 16px; border: 1px solid rgba(34,197,94,0.4); background: rgba(34,197,94,0.06); border-radius: 12px; padding: 14px 16px; }
+ .reveal-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
+ .reveal-label span { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--green); }
+ .reveal-value { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; font-size: 13px; color: var(--text); background: #050505; border: 1px solid #1c1c1c; border-radius: 8px; padding: 11px 13px; word-break: break-all; user-select: all; }
+ .reveal-note { font-size: 12px; color: var(--yellow); margin-top: 9px; line-height: 1.5; }
+ .copy { background: transparent; border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 12px; padding: 5px 11px; cursor: pointer; transition: background 0.15s, border-color 0.15s, color 0.15s; }
+ .copy:hover { background: rgba(255,255,255,0.05); }
+ .copy.copied { color: var(--green); border-color: rgba(34,197,94,0.5); }
+
+ /* usage docs */
+ .usage-doc { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 20px 22px; margin-top: 28px; }
+ .usage-doc h3 { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
+ .usage-doc pre { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; font-size: 12.5px; color: #cfcfdc; background: var(--panel2); border: 1px solid #1c1c1c; border-radius: 9px; padding: 13px 15px; overflow-x: auto; line-height: 1.6; }
+ .usage-doc a { color: var(--text); }
+
+ /* empty / error */
+ .placeholder { text-align: center; padding: 56px 24px; border: 1px dashed var(--border); border-radius: 16px; }
+ .placeholder .icon { font-size: 34px; margin-bottom: 14px; opacity: 0.8; }
+ .placeholder h2 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
+ .placeholder p { color: var(--muted); font-size: 14px; max-width: 380px; margin: 0 auto 22px; }
+ .placeholder .btn { display: inline-block; text-decoration: none; }
+
+ .toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); background: var(--panel); border: 1px solid var(--border); border-radius: 11px; padding: 12px 18px; font-size: 13px; color: var(--text); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 50; box-shadow: 0 12px 40px rgba(0,0,0,0.6); }
+ .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
+ .toast.err { border-color: rgba(239,68,68,0.4); color: #fca5a5; }
+
+ @media (max-width: 540px) { .wrap { padding: 32px 16px 72px; } .card-actions { flex-direction: column; } .card-actions .btn { width: 100%; } }
+ </style>
+</head>
+<body>
+ <header>
+ <a href="/dashboard" class="back">← Dashboard</a>
+ </header>
+
+ <div class="wrap">
+ <h1>API keys &amp; usage</h1>
+ <p class="lead">Your x402 subscription keys for calling paid three.ws endpoints. Keys issued through <a href="/aws">AWS Marketplace</a> bill to your AWS account; native keys settle on-chain. The secret is shown once at issue — rotate any time to get a fresh one.</p>
+
+ <!-- loading -->
+ <div id="state-loading" class="state active">
+ <div class="skeleton"></div>
+ <div class="skeleton"></div>
+ </div>
+
+ <!-- list -->
+ <div id="state-list" class="state">
+ <div id="cards"></div>
+ <div class="usage-doc">
+ <h3>Calling a paid endpoint</h3>
+<pre>curl https://three.ws/api/x402/agent-reputation?agent_id=&lt;uuid&gt; \
+ -H "x-api-key: <span id="example-prefix">x402_live_…</span>"</pre>
+ <p style="color:var(--muted);font-size:13px;margin-top:12px">Browse paid services in the <a href="/bazaar">x402 Bazaar</a>, or read the <a href="/docs/x402.md">x402 docs</a>.</p>
+ </div>
+ </div>
+
+ <!-- empty -->
+ <div id="state-empty" class="state">
+ <div class="placeholder">
+ <div class="icon">🔑</div>
+ <h2>No subscription keys yet</h2>
+ <p>Subscribe through AWS Marketplace to bill paid endpoints to your AWS account, or generate a key from the x402 console.</p>
+ <a href="/aws" class="btn primary">View AWS Marketplace</a>
+ </div>
+ </div>
+
+ <!-- error -->
+ <div id="state-error" class="state">
+ <div class="placeholder">
+ <div class="icon">⚠</div>
+ <h2 id="error-title">Couldn't load your keys</h2>
+ <p id="error-body">We had trouble reaching the server. Check your connection and try again.</p>
+ <button class="btn primary" id="btn-retry" type="button">Retry</button>
+ </div>
+ </div>
+ </div>
+
+ <div id="toast" class="toast"></div>
+
+ <script type="module" src="/src/billing-x402.js"></script>
+ <script src="/brand.js" defer></script>
+</body>
+</html>
diff --git a/pages/integrations.html b/pages/integrations.html
index 3882e77a9..67eec0847 100644
--- a/pages/integrations.html
+++ b/pages/integrations.html
@@ -66,14 +66,12 @@
min-height: 100%;
}
- /* ── Nav shell ─────────────────────────────────── */
header { position: sticky; top: 0; z-index: 100; }
- #nav-container { width: 100%; }
- /* ── Page layout ───────────────────────────────── */
+ /* ── Page layout ─────────────────────────────────── */
.page { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
- /* ── Hero ──────────────────────────────────────── */
+ /* ── Hero ────────────────────────────────────────── */
.hero {
padding: 80px 0 56px;
text-align: center;
@@ -97,6 +95,11 @@
border-radius: 50%;
background: var(--green);
flex-shrink: 0;
+ animation: pulse 2s ease-in-out infinite;
+ }
+ @keyframes pulse {
+ 0%, 100% { opacity: 1; }
+ 50% { opacity: 0.4; }
}
.hero h1 {
font-size: clamp(36px, 6vw, 64px);
@@ -107,7 +110,7 @@
}
.hero h1 em {
font-style: normal;
- background: linear-gradient(135deg, #fff 30%, rgba(255,255,255,0.4));
+ background: linear-gradient(135deg, #fff 30%, rgba(255,255,255,0.35));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
@@ -155,11 +158,43 @@
}
.btn-ghost:hover { color: var(--text); border-color: #444; }
- /* ── Filter bar ────────────────────────────────── */
+ /* ── Stat bar ─────────────────────────────────────── */
+ .stat-bar {
+ display: flex;
+ justify-content: center;
+ gap: 0;
+ border: 1px solid var(--border);
+ border-radius: var(--radius-lg);
+ overflow: hidden;
+ margin: 0 auto 56px;
+ max-width: 640px;
+ }
+ .stat {
+ flex: 1;
+ padding: 16px 20px;
+ text-align: center;
+ border-right: 1px solid var(--border);
+ }
+ .stat:last-child { border-right: none; }
+ .stat-value {
+ font-size: 22px;
+ font-weight: 700;
+ letter-spacing: -0.02em;
+ color: var(--text);
+ }
+ .stat-label {
+ font-size: 11px;
+ color: var(--text-3);
+ margin-top: 2px;
+ letter-spacing: 0.04em;
+ text-transform: uppercase;
+ }
+
+ /* ── Filter bar ──────────────────────────────────── */
.filter-bar {
display: flex;
align-items: center;
- gap: 6px;
+ gap: 4px;
padding: 4px;
border: 1px solid var(--border);
border-radius: 10px;
@@ -180,6 +215,7 @@
padding: 6px 14px;
border-radius: 7px;
transition: background 0.15s, color 0.15s;
+ white-space: nowrap;
}
.filter-chip:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.filter-chip.active {
@@ -187,15 +223,15 @@
color: var(--accent-ink);
}
- /* ── Grid ──────────────────────────────────────── */
+ /* ── Grid ────────────────────────────────────────── */
.grid {
display: grid;
- grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
+ grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
gap: 20px;
margin-bottom: 80px;
}
- /* ── Card ──────────────────────────────────────── */
+ /* ── Card ────────────────────────────────────────── */
.card {
background: var(--surface);
border: 1px solid var(--border);
@@ -203,13 +239,14 @@
overflow: hidden;
display: flex;
flex-direction: column;
- transition: border-color 0.2s, transform 0.2s;
+ transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.card:hover {
- border-color: var(--border-2);
+ border-color: #2e2e2e;
transform: translateY(-2px);
+ box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
- .card[hidden] { display: none; }
+ .card[hidden] { display: none !important; }
/* Preview area */
.card-preview {
@@ -225,35 +262,22 @@
position: absolute;
inset: 0;
}
- /* Category-specific preview backgrounds */
- .card[data-cat="avatar"] .card-preview-bg {
- background: radial-gradient(ellipse at 50% 60%, rgba(96,165,250,0.12) 0%, transparent 70%);
- }
- .card[data-cat="chat"] .card-preview-bg {
- background: radial-gradient(ellipse at 50% 60%, rgba(167,139,250,0.12) 0%, transparent 70%);
- }
- .card[data-cat="companion"] .card-preview-bg {
- background: radial-gradient(ellipse at 50% 60%, rgba(74,222,128,0.10) 0%, transparent 70%);
- }
- .card[data-cat="narrator"] .card-preview-bg {
- background: radial-gradient(ellipse at 50% 60%, rgba(251,191,36,0.10) 0%, transparent 70%);
- }
- .card[data-cat="crypto"] .card-preview-bg {
- background: radial-gradient(ellipse at 50% 60%, rgba(244,114,182,0.10) 0%, transparent 70%);
- }
- .card[data-cat="mcp"] .card-preview-bg {
- background: radial-gradient(ellipse at 50% 60%, rgba(167,139,250,0.08) 0%, transparent 70%);
- }
+ .card[data-cat="avatar"] .card-preview-bg { background: radial-gradient(ellipse at 50% 70%, rgba(96,165,250,0.13) 0%, transparent 70%); }
+ .card[data-cat="chat"] .card-preview-bg { background: radial-gradient(ellipse at 50% 70%, rgba(167,139,250,0.13) 0%, transparent 70%); }
+ .card[data-cat="companion"] .card-preview-bg { background: radial-gradient(ellipse at 50% 70%, rgba(74,222,128,0.11) 0%, transparent 70%); }
+ .card[data-cat="narrator"] .card-preview-bg { background: radial-gradient(ellipse at 50% 70%, rgba(251,191,36,0.11) 0%, transparent 70%); }
+ .card[data-cat="crypto"] .card-preview-bg { background: radial-gradient(ellipse at 50% 70%, rgba(244,114,182,0.11) 0%, transparent 70%); }
+ .card[data-cat="mcp"] .card-preview-bg { background: radial-gradient(ellipse at 50% 70%, rgba(167,139,250,0.08) 0%, transparent 70%); }
- /* Live avatar embed inside card */
+ /* Live avatar inside card */
.card-preview threews-avatar {
position: relative;
width: 160px;
- height: 200px;
+ height: 210px;
z-index: 1;
}
- /* Illustrated preview for non-avatar cards */
+ /* Illustrated previews */
.preview-illustration {
position: relative;
z-index: 1;
@@ -262,160 +286,207 @@
align-items: center;
gap: 10px;
}
- .preview-icon {
- width: 56px;
- height: 56px;
- border-radius: 14px;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 26px;
- }
- .preview-mockup {
- background: rgba(255,255,255,0.04);
- border: 1px solid rgba(255,255,255,0.08);
- border-radius: 10px;
- padding: 10px 14px;
- font-size: 12px;
- color: var(--text-2);
- font-family: 'JetBrains Mono', 'SF Mono', monospace;
- line-height: 1.6;
- text-align: left;
- width: 220px;
- }
- .preview-mockup .k { color: #60a5fa; }
- .preview-mockup .s { color: #4ade80; }
- .preview-mockup .c { color: #71717a; }
- /* Chat preview mockup */
- .preview-chat {
- display: flex;
- flex-direction: column;
- gap: 8px;
- width: 240px;
- }
- .preview-chat-bubble {
- background: rgba(255,255,255,0.07);
- border: 1px solid rgba(255,255,255,0.08);
- border-radius: 12px 12px 12px 2px;
- padding: 8px 12px;
- font-size: 12px;
- color: var(--text-2);
- max-width: 200px;
+ /* Scaled live iframe preview */
+ .preview-iframe-wrap {
+ position: relative;
+ z-index: 1;
+ width: 148px; /* 420 * 0.352 */
+ height: 211px; /* 600 * 0.352 */
+ overflow: hidden;
+ border-radius: 10px;
+ pointer-events: none;
}
- .preview-chat-bubble.user {
- background: rgba(96,165,250,0.12);
- border-radius: 12px 12px 2px 12px;
- align-self: flex-end;
- color: #93c5fd;
+ .preview-iframe-wrap iframe {
+ width: 420px;
+ height: 600px;
+ border: none;
+ transform: scale(0.352);
+ transform-origin: top left;
}
- /* Walk companion mockup */
- .preview-walk {
+ /* Walk preview */
+ .preview-walk-wrap {
position: relative;
+ z-index: 1;
width: 240px;
- height: 140px;
+ height: 160px;
border: 1px solid rgba(255,255,255,0.06);
border-radius: 10px;
- background: rgba(255,255,255,0.03);
+ background: rgba(255,255,255,0.02);
overflow: hidden;
}
- .preview-walk-body {
- position: absolute;
- bottom: 12px;
- right: 16px;
- width: 52px;
- height: 80px;
- background: rgba(74,222,128,0.12);
- border: 1px solid rgba(74,222,128,0.25);
- border-radius: 10px;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 28px;
- }
.preview-walk-label {
position: absolute;
- top: 10px;
- left: 12px;
- font-size: 10px;
+ top: 8px;
+ left: 10px;
+ font-size: 9px;
color: var(--text-3);
font-family: 'JetBrains Mono', monospace;
+ letter-spacing: 0.04em;
}
- .preview-walk-site {
+ .preview-walk-lines {
position: absolute;
- top: 30px;
- left: 12px;
- right: 72px;
+ top: 28px;
+ left: 10px;
+ right: 70px;
display: flex;
flex-direction: column;
- gap: 5px;
+ gap: 6px;
}
.preview-walk-line {
- height: 8px;
- border-radius: 4px;
+ height: 7px;
+ border-radius: 3px;
+ background: rgba(255,255,255,0.05);
+ }
+ .preview-walk-avatar {
+ position: absolute;
+ bottom: 10px;
+ right: 12px;
+ width: 48px;
+ height: 72px;
+ border-radius: 10px;
+ background: rgba(74,222,128,0.10);
+ border: 1px solid rgba(74,222,128,0.22);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 24px;
+ }
+
+ /* Chat preview */
+ .preview-chat {
+ display: flex;
+ flex-direction: column;
+ gap: 7px;
+ width: 230px;
+ }
+ .preview-chat-bubble {
background: rgba(255,255,255,0.06);
+ border: 1px solid rgba(255,255,255,0.08);
+ border-radius: 10px 10px 10px 2px;
+ padding: 7px 11px;
+ font-size: 11px;
+ color: var(--text-2);
+ max-width: 190px;
+ line-height: 1.5;
+ }
+ .preview-chat-bubble.user {
+ background: rgba(96,165,250,0.10);
+ border-color: rgba(96,165,250,0.15);
+ border-radius: 10px 10px 2px 10px;
+ align-self: flex-end;
+ color: #93c5fd;
}
- /* Token widget mockup */
+ /* Token preview */
.preview-token {
display: flex;
align-items: center;
- gap: 12px;
+ gap: 11px;
background: rgba(255,255,255,0.04);
border: 1px solid rgba(255,255,255,0.08);
border-radius: 12px;
- padding: 12px 16px;
- width: 240px;
+ padding: 11px 14px;
+ width: 228px;
}
.preview-token-avatar {
- width: 40px;
- height: 40px;
+ width: 38px; height: 38px;
border-radius: 50%;
- background: rgba(244,114,182,0.2);
- border: 1px solid rgba(244,114,182,0.3);
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 20px;
- flex-shrink: 0;
+ background: rgba(244,114,182,0.15);
+ border: 1px solid rgba(244,114,182,0.25);
+ display: flex; align-items: center; justify-content: center;
+ font-size: 18px; flex-shrink: 0;
}
- .preview-token-info { flex: 1; min-width: 0; }
.preview-token-name { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.preview-token-price { font-size: 11px; color: var(--green); font-family: monospace; }
- .preview-token-change { font-size: 10px; color: var(--text-3); }
+ .preview-token-change { font-size: 10px; color: var(--text-3); margin-top: 1px; }
- /* MCP mockup */
+ /* MCP preview */
.preview-mcp {
- width: 240px;
display: flex;
flex-direction: column;
- gap: 6px;
+ gap: 5px;
+ width: 228px;
}
.preview-mcp-tool {
- background: rgba(255,255,255,0.04);
- border: 1px solid rgba(255,255,255,0.07);
- border-radius: 8px;
- padding: 7px 10px;
display: flex;
align-items: center;
gap: 8px;
+ background: rgba(255,255,255,0.04);
+ border: 1px solid rgba(255,255,255,0.07);
+ border-radius: 7px;
+ padding: 6px 10px;
font-size: 11px;
color: var(--text-2);
font-family: 'JetBrains Mono', monospace;
}
- .preview-mcp-tool-dot {
- width: 6px; height: 6px;
+ .preview-mcp-dot {
+ width: 5px; height: 5px;
+ border-radius: 50%; flex-shrink: 0;
+ }
+
+ /* Narrator preview */
+ .preview-narrator {
+ display: flex;
+ gap: 10px;
+ align-items: flex-start;
+ width: 240px;
+ }
+ .preview-narrator-avatar {
+ width: 36px; height: 36px;
border-radius: 50%;
- flex-shrink: 0;
+ background: rgba(251,191,36,0.12);
+ border: 1px solid rgba(251,191,36,0.22);
+ display: flex; align-items: center; justify-content: center;
+ font-size: 18px; flex-shrink: 0;
+ }
+ .preview-narrator-bubble {
+ background: rgba(251,191,36,0.06);
+ border: 1px solid rgba(251,191,36,0.14);
+ border-radius: 2px 10px 10px 10px;
+ padding: 8px 11px;
+ font-size: 11px;
+ color: rgba(251,191,36,0.7);
+ line-height: 1.55;
+ flex: 1;
}
+ /* "Try live" button on cards */
+ .try-live-btn {
+ position: absolute;
+ bottom: 10px;
+ right: 10px;
+ z-index: 2;
+ appearance: none;
+ background: rgba(0,0,0,0.6);
+ backdrop-filter: blur(8px);
+ border: 1px solid rgba(255,255,255,0.15);
+ border-radius: 20px;
+ cursor: pointer;
+ font: inherit;
+ font-size: 11px;
+ font-weight: 600;
+ color: var(--text);
+ padding: 5px 12px;
+ display: flex;
+ align-items: center;
+ gap: 5px;
+ transition: background 0.15s, border-color 0.15s;
+ text-decoration: none;
+ }
+ .try-live-btn:hover {
+ background: rgba(255,255,255,0.12);
+ border-color: rgba(255,255,255,0.3);
+ }
+ .try-live-btn svg { flex-shrink: 0; }
+
/* Card body */
.card-body {
- padding: 20px;
+ padding: 18px 20px 20px;
display: flex;
flex-direction: column;
- gap: 12px;
+ gap: 10px;
flex: 1;
}
.card-meta {
@@ -432,47 +503,46 @@
padding: 3px 8px;
border-radius: 100px;
}
- .cat-badge.avatar { background: rgba(96,165,250,0.15); color: #93c5fd; }
- .cat-badge.chat { background: rgba(167,139,250,0.15); color: #c4b5fd; }
- .cat-badge.companion { background: rgba(74,222,128,0.12); color: #86efac; }
- .cat-badge.narrator { background: rgba(251,191,36,0.12); color: #fcd34d; }
- .cat-badge.crypto { background: rgba(244,114,182,0.12); color: #f9a8d4; }
- .cat-badge.mcp { background: rgba(167,139,250,0.10); color: #c4b5fd; }
+ .cat-badge.avatar { background: rgba(96,165,250,0.14); color: #93c5fd; }
+ .cat-badge.chat { background: rgba(167,139,250,0.14); color: #c4b5fd; }
+ .cat-badge.companion { background: rgba(74,222,128,0.12); color: #86efac; }
+ .cat-badge.narrator { background: rgba(251,191,36,0.12); color: #fcd34d; }
+ .cat-badge.crypto { background: rgba(244,114,182,0.12); color: #f9a8d4; }
+ .cat-badge.mcp { background: rgba(167,139,250,0.10); color: #c4b5fd; }
.diff-badge {
font-size: 10px;
font-weight: 600;
- letter-spacing: 0.04em;
color: var(--text-3);
border: 1px solid var(--border);
border-radius: 100px;
padding: 2px 8px;
}
.card-title {
- font-size: 17px;
+ font-size: 16px;
font-weight: 700;
letter-spacing: -0.02em;
- line-height: 1.2;
+ line-height: 1.25;
}
.card-desc {
- font-size: 14px;
+ font-size: 13px;
color: var(--text-2);
line-height: 1.6;
}
/* Code section */
- .card-code { margin-top: auto; }
+ .card-code { margin-top: auto; padding-top: 4px; }
.code-toggle {
appearance: none;
background: none;
border: 1px solid var(--border);
- border-radius: 8px;
+ border-radius: 7px;
cursor: pointer;
font: inherit;
- font-size: 13px;
+ font-size: 12px;
font-weight: 500;
color: var(--text-2);
- padding: 8px 14px;
+ padding: 7px 12px;
width: 100%;
text-align: left;
display: flex;
@@ -489,9 +559,9 @@
.code-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.code-toggle-label { flex: 1; }
.code-panel {
- margin-top: 10px;
+ margin-top: 8px;
border: 1px solid var(--border);
- border-radius: 10px;
+ border-radius: 9px;
overflow: hidden;
display: none;
}
@@ -500,14 +570,15 @@
display: flex;
align-items: center;
justify-content: space-between;
- padding: 8px 12px;
+ padding: 7px 10px;
background: rgba(255,255,255,0.03);
border-bottom: 1px solid var(--border);
}
.code-lang {
- font-size: 11px;
+ font-size: 10px;
font-family: 'JetBrains Mono', 'SF Mono', monospace;
color: var(--text-3);
+ letter-spacing: 0.04em;
}
.copy-btn {
appearance: none;
@@ -519,43 +590,120 @@
font-size: 11px;
font-weight: 600;
color: var(--text-2);
- padding: 4px 10px;
+ padding: 3px 9px;
transition: background 0.15s, color 0.15s;
}
.copy-btn:hover { background: rgba(255,255,255,0.12); color: var(--text); }
.copy-btn.copied { color: var(--green); }
pre.code-block {
margin: 0;
- padding: 14px;
- font-size: 11.5px;
+ padding: 12px 14px;
+ font-size: 11px;
font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
- line-height: 1.7;
+ line-height: 1.75;
color: var(--text-2);
overflow-x: auto;
tab-size: 2;
white-space: pre;
}
- pre.code-block .k { color: #60a5fa; } /* tag names / keywords */
- pre.code-block .a { color: #c4b5fd; } /* attributes */
- pre.code-block .s { color: #86efac; } /* strings */
- pre.code-block .c { color: #52525b; } /* comments */
- pre.code-block .p { color: #fbbf24; } /* punctuation */
+ pre.code-block .k { color: #60a5fa; }
+ pre.code-block .a { color: #c4b5fd; }
+ pre.code-block .s { color: #86efac; }
+ pre.code-block .c { color: #52525b; }
+ pre.code-block .p { color: #fbbf24; }
- /* ── Showcase strip ────────────────────────────── */
+ /* ── Live demo modal ──────────────────────────────── */
+ .modal-backdrop {
+ position: fixed;
+ inset: 0;
+ background: rgba(0,0,0,0.85);
+ backdrop-filter: blur(12px);
+ z-index: 1000;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 20px;
+ opacity: 0;
+ pointer-events: none;
+ transition: opacity 0.22s;
+ }
+ .modal-backdrop.open {
+ opacity: 1;
+ pointer-events: all;
+ }
+ .modal {
+ background: var(--surface);
+ border: 1px solid var(--border-2);
+ border-radius: 20px;
+ overflow: hidden;
+ display: flex;
+ flex-direction: column;
+ max-width: 460px;
+ width: 100%;
+ transform: translateY(16px) scale(0.97);
+ transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
+ }
+ .modal-backdrop.open .modal {
+ transform: translateY(0) scale(1);
+ }
+ .modal-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 14px 18px;
+ border-bottom: 1px solid var(--border);
+ }
+ .modal-title {
+ font-size: 14px;
+ font-weight: 600;
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ }
+ .modal-live-dot {
+ width: 7px; height: 7px;
+ border-radius: 50%;
+ background: var(--green);
+ animation: pulse 2s ease-in-out infinite;
+ }
+ .modal-close {
+ appearance: none;
+ background: rgba(255,255,255,0.06);
+ border: none;
+ border-radius: 50%;
+ cursor: pointer;
+ width: 28px; height: 28px;
+ display: flex; align-items: center; justify-content: center;
+ color: var(--text-2);
+ transition: background 0.15s, color 0.15s;
+ }
+ .modal-close:hover { background: rgba(255,255,255,0.12); color: var(--text); }
+ .modal-body {
+ padding: 0;
+ line-height: 0;
+ }
+ .modal-body iframe {
+ width: 100%;
+ height: 560px;
+ border: none;
+ display: block;
+ }
+
+ /* ── Showcase strip ───────────────────────────────── */
.showcase {
border-top: 1px solid var(--border);
- padding: 64px 0;
+ padding: 72px 0;
text-align: center;
}
.showcase-label {
- font-size: 12px;
- letter-spacing: 0.08em;
+ font-size: 11px;
+ letter-spacing: 0.1em;
text-transform: uppercase;
color: var(--text-3);
- margin-bottom: 16px;
+ margin-bottom: 14px;
}
.showcase-title {
- font-size: clamp(22px, 3vw, 32px);
+ font-size: clamp(24px, 3vw, 34px);
font-weight: 700;
letter-spacing: -0.02em;
margin-bottom: 12px;
@@ -565,32 +713,32 @@
color: var(--text-2);
max-width: 48ch;
margin: 0 auto 28px;
- line-height: 1.6;
+ line-height: 1.65;
}
- .showcase-examples {
+ .showcase-tags {
display: flex;
justify-content: center;
- gap: 12px;
+ gap: 8px;
flex-wrap: wrap;
- margin-bottom: 28px;
+ margin-bottom: 32px;
}
- .showcase-example-tag {
- font-size: 13px;
+ .showcase-tag {
+ font-size: 12px;
color: var(--text-2);
border: 1px solid var(--border);
border-radius: 100px;
- padding: 6px 14px;
+ padding: 5px 14px;
background: var(--surface);
}
- .showcase-example-tag strong { color: var(--text); }
-
- /* ── Footer ────────────────────────────────────── */
+ .showcase-tag strong { color: var(--text); }
@media (max-width: 640px) {
- .hero { padding: 48px 0 40px; }
- .hero h1 { font-size: 36px; }
+ .hero { padding: 48px 0 36px; }
+ .hero h1 { font-size: 34px; }
+ .stat-bar { max-width: 100%; }
.filter-bar { justify-content: center; }
.grid { grid-template-columns: 1fr; }
+ .modal-body iframe { height: 480px; }
}
</style>
</head>
@@ -599,414 +747,444 @@
<header><div id="nav-container"></div></header>
<main>
- <div class="page">
+<div class="page">
- <!-- ── Hero ──────────────────────────────────────────── -->
- <section class="hero">
- <div class="hero-eyebrow">
- <span class="hero-eyebrow-dot" aria-hidden="true"></span>
- Powered by three.ws
- </div>
- <h1>One line of code.<br><em>Any site.</em></h1>
- <p class="hero-sub">
- Drop 3D agents, chat widgets, walk companions, and live token data
- into any website — no backend required.
- </p>
- <div class="hero-cta">
- <a href="/create" class="btn-primary">
- <svg width="14" height="14" viewBox="0 0 14 14" fill="none" aria-hidden="true">
- <path d="M7 1v12M1 7h12" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
- </svg>
- Create an agent
- </a>
- <a href="/docs/embedding" class="btn-ghost">Read the docs</a>
- </div>
- </section>
+ <!-- ── Hero ───────────────────────────────────────────────── -->
+ <section class="hero">
+ <div class="hero-eyebrow">
+ <span class="hero-eyebrow-dot" aria-hidden="true"></span>
+ Powered by three.ws
+ </div>
+ <h1>One line of code.<br><em>Any site.</em></h1>
+ <p class="hero-sub">
+ Drop 3D agents, chat widgets, walk companions, and live token data
+ into any website — no backend, no framework, no friction.
+ </p>
+ <div class="hero-cta">
+ <a href="/create" class="btn-primary">
+ <svg width="14" height="14" viewBox="0 0 14 14" fill="none" aria-hidden="true">
+ <path d="M7 1v12M1 7h12" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
+ </svg>
+ Create an agent
+ </a>
+ <a href="/docs/embedding" class="btn-ghost">Read the docs →</a>
+ </div>
+ </section>
- <!-- ── Filter ────────────────────────────────────────── -->
- <div class="filter-bar" role="group" aria-label="Filter integrations by category">
- <button class="filter-chip active" data-filter="all">All</button>
- <button class="filter-chip" data-filter="avatar">3D Avatar</button>
- <button class="filter-chip" data-filter="chat">Chat Agent</button>
- <button class="filter-chip" data-filter="companion">Walk Companion</button>
- <button class="filter-chip" data-filter="narrator">Page Narrator</button>
- <button class="filter-chip" data-filter="crypto">Token Widget</button>
- <button class="filter-chip" data-filter="mcp">MCP Server</button>
+ <!-- ── Stats ──────────────────────────────────────────────── -->
+ <div class="stat-bar" aria-hidden="true">
+ <div class="stat">
+ <div class="stat-value">6</div>
+ <div class="stat-label">Integration types</div>
+ </div>
+ <div class="stat">
+ <div class="stat-value">1</div>
+ <div class="stat-label">Script tag</div>
+ </div>
+ <div class="stat">
+ <div class="stat-value">0</div>
+ <div class="stat-label">Backend needed</div>
</div>
+ <div class="stat">
+ <div class="stat-value">∞</div>
+ <div class="stat-label">Sites it works on</div>
+ </div>
+ </div>
+
+ <!-- ── Filter ─────────────────────────────────────────────── -->
+ <div class="filter-bar" role="group" aria-label="Filter integrations">
+ <button class="filter-chip active" data-filter="all">All</button>
+ <button class="filter-chip" data-filter="avatar">3D Avatar</button>
+ <button class="filter-chip" data-filter="chat">Chat Agent</button>
+ <button class="filter-chip" data-filter="companion">Walk Companion</button>
+ <button class="filter-chip" data-filter="narrator">Page Narrator</button>
+ <button class="filter-chip" data-filter="crypto">Token Widget</button>
+ <button class="filter-chip" data-filter="mcp">MCP Server</button>
+ </div>
- <!-- ── Integration grid ──────────────────────────────── -->
- <div class="grid" id="integration-grid">
+ <!-- ── Integration grid ───────────────────────────────────── -->
+ <div class="grid" id="integration-grid">
- <!-- 1. 3D Avatar Viewer -->
- <article class="card" data-cat="avatar">
- <div class="card-preview">
- <div class="card-preview-bg" aria-hidden="true"></div>
- <threews-avatar
- avatar-id="avatar_demo_disk_cz"
- hide-chrome
- pose="idle"
- aria-label="Live 3D avatar preview"
- ></threews-avatar>
+ <!-- 1. 3D Avatar Viewer -->
+ <article class="card" data-cat="avatar">
+ <div class="card-preview">
+ <div class="card-preview-bg" aria-hidden="true"></div>
+ <threews-avatar
+ avatar-id="avatar_demo_disk_cz"
+ hide-chrome
+ pose="idle"
+ aria-label="Live 3D avatar preview"
+ ></threews-avatar>
+ <a href="/embed-demo" class="try-live-btn" target="_blank" rel="noopener">
+ <svg width="10" height="10" viewBox="0 0 10 10" fill="none" aria-hidden="true">
+ <path d="M1 9L9 1M9 1H4M9 1V6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+ </svg>
+ Full demo
+ </a>
+ </div>
+ <div class="card-body">
+ <div class="card-meta">
+ <span class="cat-badge avatar">3D Avatar</span>
+ <span class="diff-badge">Simple</span>
</div>
- <div class="card-body">
- <div class="card-meta">
- <span class="cat-badge avatar">3D Avatar</span>
- <span class="diff-badge">Simple</span>
- </div>
- <h2 class="card-title">Avatar Viewer</h2>
- <p class="card-desc">
- A rotatable, animated 3D avatar — transparent background, OBS-ready, fully scriptable.
- Drop it on any page as a web component.
- </p>
- <div class="card-code">
- <button class="code-toggle" aria-expanded="false" aria-controls="code-avatar">
- <svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
- <path d="M2 4l4 4 4-4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
- </svg>
- <span class="code-toggle-label">Get embed code</span>
- </button>
- <div class="code-panel" id="code-avatar" role="region">
- <div class="code-header">
- <span class="code-lang">html</span>
- <button class="copy-btn" aria-label="Copy code">Copy</button>
- </div>
- <pre class="code-block" data-code><span class="c">&lt;!-- Load once on your page --&gt;</span>
+ <h2 class="card-title">Avatar Viewer</h2>
+ <p class="card-desc">A rotatable, animated 3D avatar — transparent background, OBS-ready, fully scriptable via JS. Works as a web component on any page.</p>
+ <div class="card-code">
+ <button class="code-toggle" aria-expanded="false" aria-controls="code-avatar">
+ <svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
+ <path d="M2 4l4 4 4-4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+ </svg>
+ <span class="code-toggle-label">Get embed code</span>
+ </button>
+ <div class="code-panel" id="code-avatar" role="region">
+ <div class="code-header">
+ <span class="code-lang">html</span>
+ <button class="copy-btn" aria-label="Copy code">Copy</button>
+ </div>
+ <pre class="code-block" data-code><span class="c">&lt;!-- Load once --&gt;</span>
<span class="k">&lt;script</span> <span class="a">src</span>=<span class="s">"https://three.ws/embed.js"</span> <span class="a">defer</span><span class="k">&gt;&lt;/script&gt;</span>
<span class="c">&lt;!-- Drop anywhere in your HTML --&gt;</span>
<span class="k">&lt;threews-avatar</span>
- <span class="a">avatar-id</span>=<span class="s">"your-avatar-id"</span>
+ <span class="a">avatar-id</span>=<span class="s">"avatar_demo_disk_cz"</span>
<span class="a">hide-chrome</span>
<span class="a">pose</span>=<span class="s">"idle"</span>
<span class="k">&gt;&lt;/threews-avatar&gt;</span>
-<span class="c">&lt;!-- Optional JS control --&gt;</span>
+<span class="c">&lt;!-- Optional: JS control --&gt;</span>
<span class="k">&lt;script&gt;</span>
<span class="a">const</span> el = document.querySelector(<span class="s">'threews-avatar'</span>);
<span class="a">await</span> el.ready;
el.play(<span class="s">'wave'</span>);
<span class="k">&lt;/script&gt;</span></pre>
- </div>
</div>
</div>
- </article>
+ </div>
+ </article>
- <!-- 2. Chat Agent -->
- <article class="card" data-cat="chat">
- <div class="card-preview">
- <div class="card-preview-bg" aria-hidden="true"></div>
- <div class="preview-illustration" aria-hidden="true">
- <div class="preview-icon" style="background: rgba(167,139,250,0.12); border: 1px solid rgba(167,139,250,0.2);">🤖</div>
- <div class="preview-chat">
- <div class="preview-chat-bubble">Hey, I'm PumpBot. What do you want to look at?</div>
- <div class="preview-chat-bubble user">Tell me about this token</div>
- <div class="preview-chat-bubble">Let me pull the latest data for you…</div>
- </div>
+ <!-- 2. Chat Agent -->
+ <article class="card" data-cat="chat">
+ <div class="card-preview">
+ <div class="card-preview-bg" aria-hidden="true"></div>
+ <div class="preview-illustration" aria-hidden="true">
+ <div class="preview-chat">
+ <div class="preview-chat-bubble">Hey, I'm PumpBot. I'm still in beta — what do you want to look at?</div>
+ <div class="preview-chat-bubble user">Tell me about this token</div>
+ <div class="preview-chat-bubble">Let me pull the latest data for you…</div>
</div>
</div>
- <div class="card-body">
- <div class="card-meta">
- <span class="cat-badge chat">Chat Agent</span>
- <span class="diff-badge">Simple</span>
- </div>
- <h2 class="card-title">Talking Chat Agent</h2>
- <p class="card-desc">
- A full chat interface with a live 3D character. Voice or text. Bring your AI agent to life
- on any site — like PumpBot.
- </p>
- <div class="card-code">
- <button class="code-toggle" aria-expanded="false" aria-controls="code-chat">
- <svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
- <path d="M2 4l4 4 4-4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
- </svg>
- <span class="code-toggle-label">Get embed code</span>
- </button>
- <div class="code-panel" id="code-chat" role="region">
- <div class="code-header">
- <span class="code-lang">html</span>
- <button class="copy-btn" aria-label="Copy code">Copy</button>
- </div>
- <pre class="code-block" data-code><span class="c">&lt;!-- Injects a 420×600 chat agent iframe --&gt;</span>
+ <button class="try-live-btn" data-modal-widget="wdgt_demo_talking" data-modal-title="Chat Agent — Live Demo" aria-label="Try live demo">
+ <span class="modal-live-dot" aria-hidden="true" style="width:6px;height:6px;border-radius:50%;background:var(--green);"></span>
+ Try live
+ </button>
+ </div>
+ <div class="card-body">
+ <div class="card-meta">
+ <span class="cat-badge chat">Chat Agent</span>
+ <span class="diff-badge">Simple</span>
+ </div>
+ <h2 class="card-title">Talking Chat Agent</h2>
+ <p class="card-desc">A full chat interface with a live 3D character. Voice or text. The same tech behind PumpBot — drop it on any site in seconds.</p>
+ <div class="card-code">
+ <button class="code-toggle" aria-expanded="false" aria-controls="code-chat">
+ <svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
+ <path d="M2 4l4 4 4-4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+ </svg>
+ <span class="code-toggle-label">Get embed code</span>
+ </button>
+ <div class="code-panel" id="code-chat" role="region">
+ <div class="code-header">
+ <span class="code-lang">html</span>
+ <button class="copy-btn" aria-label="Copy code">Copy</button>
+ </div>
+ <pre class="code-block" data-code><span class="c">&lt;!-- Paste this where you want the chat agent --&gt;</span>
<span class="k">&lt;script</span>
<span class="a">src</span>=<span class="s">"https://three.ws/embed.js"</span>
- <span class="a">data-widget</span>=<span class="s">"your-widget-id"</span>
+ <span class="a">data-widget</span>=<span class="s">"wdgt_demo_talking"</span>
<span class="a">data-type</span>=<span class="s">"talking-agent"</span>
<span class="a">defer</span>
<span class="k">&gt;&lt;/script&gt;</span>
-<span class="c">&lt;!-- Or control the iframe with JS --&gt;</span>
-<span class="k">&lt;script</span> <span class="a">src</span>=<span class="s">"https://three.ws/embed-sdk.js"</span><span class="k">&gt;&lt;/script&gt;</span>
-<span class="k">&lt;script&gt;</span>
- <span class="a">const</span> agent = Agent3D.connect(iframeEl, {
- agentId: <span class="s">'your-agent-id'</span>,
- onReady: () =&gt; agent.send(<span class="s">'Hello!'</span>),
- });
-<span class="k">&lt;/script&gt;</span></pre>
- </div>
+<span class="c">&lt;!-- Replace wdgt_demo_talking with your widget ID --&gt;
+&lt;!-- Get yours at three.ws/widgets --&gt;</span></pre>
</div>
</div>
- </article>
+ </div>
+ </article>
- <!-- 3. Walk Companion -->
- <article class="card" data-cat="companion">
- <div class="card-preview">
- <div class="card-preview-bg" aria-hidden="true"></div>
- <div class="preview-illustration" aria-hidden="true">
- <div class="preview-walk">
- <span class="preview-walk-label">yoursite.com</span>
- <div class="preview-walk-site">
- <div class="preview-walk-line" style="width: 80%"></div>
- <div class="preview-walk-line" style="width: 60%"></div>
- <div class="preview-walk-line" style="width: 70%"></div>
- <div class="preview-walk-line" style="width: 45%"></div>
- </div>
- <div class="preview-walk-body">🚶</div>
+ <!-- 3. Walk Companion -->
+ <article class="card" data-cat="companion">
+ <div class="card-preview">
+ <div class="card-preview-bg" aria-hidden="true"></div>
+ <div class="preview-illustration" aria-hidden="true">
+ <div class="preview-walk-wrap">
+ <span class="preview-walk-label">yoursite.com</span>
+ <div class="preview-walk-lines">
+ <div class="preview-walk-line" style="width:85%"></div>
+ <div class="preview-walk-line" style="width:64%"></div>
+ <div class="preview-walk-line" style="width:76%"></div>
+ <div class="preview-walk-line" style="width:50%"></div>
+ <div class="preview-walk-line" style="width:70%"></div>
</div>
+ <div class="preview-walk-avatar">🚶</div>
</div>
</div>
- <div class="card-body">
- <div class="card-meta">
- <span class="cat-badge companion">Walk Companion</span>
- <span class="diff-badge">Simple</span>
- </div>
- <h2 class="card-title">Walk Companion</h2>
- <p class="card-desc">
- A floating 3D character that lives in the corner of your site. It walks, gestures,
- and responds to your users — with one script tag.
- </p>
- <div class="card-code">
- <button class="code-toggle" aria-expanded="false" aria-controls="code-companion">
- <svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
- <path d="M2 4l4 4 4-4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
- </svg>
- <span class="code-toggle-label">Get embed code</span>
- </button>
- <div class="code-panel" id="code-companion" role="region">
- <div class="code-header">
- <span class="code-lang">html</span>
- <button class="copy-btn" aria-label="Copy code">Copy</button>
- </div>
- <pre class="code-block" data-code><span class="c">&lt;!-- Floating corner avatar — one tag --&gt;</span>
+ <button class="try-live-btn" data-modal-widget="wdgt_demo_walkavt" data-modal-title="Walk Companion — Live Demo" aria-label="Try live demo">
+ <span style="width:6px;height:6px;border-radius:50%;background:var(--green);flex-shrink:0;" aria-hidden="true"></span>
+ Try live
+ </button>
+ </div>
+ <div class="card-body">
+ <div class="card-meta">
+ <span class="cat-badge companion">Walk Companion</span>
+ <span class="diff-badge">Simple</span>
+ </div>
+ <h2 class="card-title">Walk Companion</h2>
+ <p class="card-desc">A floating 3D character fixed to the corner of any site. It walks, gestures, and speaks — with one script tag. No backend needed.</p>
+ <div class="card-code">
+ <button class="code-toggle" aria-expanded="false" aria-controls="code-companion">
+ <svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
+ <path d="M2 4l4 4 4-4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+ </svg>
+ <span class="code-toggle-label">Get embed code</span>
+ </button>
+ <div class="code-panel" id="code-companion" role="region">
+ <div class="code-header">
+ <span class="code-lang">html</span>
+ <button class="copy-btn" aria-label="Copy code">Copy</button>
+ </div>
+ <pre class="code-block" data-code><span class="c">&lt;!-- Floating corner avatar — one tag --&gt;</span>
<span class="k">&lt;script</span>
<span class="a">src</span>=<span class="s">"https://three.ws/walk-embed-sdk.js"</span>
- <span class="a">data-avatar</span>=<span class="s">"your-avatar-id"</span>
+ <span class="a">data-avatar</span>=<span class="s">"avatar_demo_disk_cz"</span>
<span class="a">data-position</span>=<span class="s">"bottom-right"</span>
<span class="a">data-env</span>=<span class="s">"studio"</span>
<span class="a">defer</span>
<span class="k">&gt;&lt;/script&gt;</span>
-<span class="c">&lt;!-- Control with JS --&gt;</span>
+<span class="c">&lt;!-- Optional: JS control --&gt;</span>
<span class="k">&lt;script&gt;</span>
- <span class="a">const</span> a = ThreeWalkAvatar.embed(<span class="s">'#my-iframe'</span>);
+ <span class="a">const</span> a = ThreeWalkAvatar.embed(<span class="s">'#avatar-iframe'</span>);
a.on(<span class="s">'ready'</span>, () =&gt; {
a.gesture(<span class="s">'wave'</span>);
- a.say(<span class="s">'Welcome!'</span>, <span class="s">'aria'</span>);
+ a.say(<span class="s">'Welcome!'</span>);
});
<span class="k">&lt;/script&gt;</span></pre>
- </div>
</div>
</div>
- </article>
+ </div>
+ </article>
- <!-- 4. Page Narrator -->
- <article class="card" data-cat="narrator">
- <div class="card-preview">
- <div class="card-preview-bg" aria-hidden="true"></div>
- <div class="preview-illustration" aria-hidden="true">
- <div class="preview-icon" style="background: rgba(251,191,36,0.10); border: 1px solid rgba(251,191,36,0.2);">📖</div>
- <div class="preview-mockup">
-<span class="k">&lt;page-agent</span>
- <span class="a">agent-id</span>=<span class="s">"my-agent"</span>
-<span class="k">&gt;&lt;/page-agent&gt;</span>
-<span class="c">// reads your page, explains it</span>
+ <!-- 4. Page Narrator -->
+ <article class="card" data-cat="narrator">
+ <div class="card-preview">
+ <div class="card-preview-bg" aria-hidden="true"></div>
+ <div class="preview-illustration" aria-hidden="true">
+ <div class="preview-narrator">
+ <div class="preview-narrator-avatar">📖</div>
+ <div class="preview-narrator-bubble">
+ "Welcome! I'm Nova. I can walk you through this page — just ask me anything."
</div>
</div>
</div>
- <div class="card-body">
- <div class="card-meta">
- <span class="cat-badge narrator">Page Narrator</span>
- <span class="diff-badge">Simple</span>
- </div>
- <h2 class="card-title">Page Narrator</h2>
- <p class="card-desc">
- A 3D agent that reads your page and guides visitors through your content.
- Add it to a docs site, landing page, or blog — no setup required.
- </p>
- <div class="card-code">
- <button class="code-toggle" aria-expanded="false" aria-controls="code-narrator">
- <svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
- <path d="M2 4l4 4 4-4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
- </svg>
- <span class="code-toggle-label">Get embed code</span>
- </button>
- <div class="code-panel" id="code-narrator" role="region">
- <div class="code-header">
- <span class="code-lang">html</span>
- <button class="copy-btn" aria-label="Copy code">Copy</button>
- </div>
- <pre class="code-block" data-code><span class="c">&lt;!-- Load the SDK --&gt;</span>
-<span class="k">&lt;script</span> <span class="a">src</span>=<span class="s">"https://three.ws/embed.js"</span> <span class="a">defer</span><span class="k">&gt;&lt;/script&gt;</span>
+ </div>
+ <div class="card-body">
+ <div class="card-meta">
+ <span class="cat-badge narrator">Page Narrator</span>
+ <span class="diff-badge">Simple</span>
+ </div>
+ <h2 class="card-title">Page Narrator</h2>
+ <p class="card-desc">A 3D agent that reads your page and guides visitors through your content — great for docs, landing pages, and blogs. Zero config.</p>
+ <div class="card-code">
+ <button class="code-toggle" aria-expanded="false" aria-controls="code-narrator">
+ <svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
+ <path d="M2 4l4 4 4-4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+ </svg>
+ <span class="code-toggle-label">Get embed code</span>
+ </button>
+ <div class="code-panel" id="code-narrator" role="region">
+ <div class="code-header">
+ <span class="code-lang">html</span>
+ <button class="copy-btn" aria-label="Copy code">Copy</button>
+ </div>
+ <pre class="code-block" data-code><span class="c">&lt;!-- npm install @three-ws/page-agent --&gt;</span>
-<span class="c">&lt;!-- Drop the web component on your page --&gt;</span>
-<span class="k">&lt;page-agent</span>
- <span class="a">agent-id</span>=<span class="s">"your-agent-id"</span>
-<span class="k">&gt;&lt;/page-agent&gt;</span>
+<span class="c">&lt;!-- Option 1: CDN (no build step) --&gt;</span>
+<span class="k">&lt;script</span>
+ <span class="a">src</span>=<span class="s">"https://cdn.jsdelivr.net/npm/@three-ws/page-agent/dist/page-agent.global.js"</span>
+ <span class="a">data-page-agent</span>
+ <span class="a">data-avatar</span>=<span class="s">"nova"</span>
+ <span class="a">data-auto-narrate</span>
+ <span class="a">defer</span>
+<span class="k">&gt;&lt;/script&gt;</span>
-<span class="c">&lt;!-- npm install @three-ws/page-agent --&gt;</span>
-<span class="c">&lt;!-- import '@three-ws/page-agent'; --&gt;</span></pre>
- </div>
+<span class="c">&lt;!-- Option 2: Web component --&gt;</span>
+<span class="k">&lt;page-agent</span>
+ <span class="a">agent-id</span>=<span class="s">"sol"</span>
+ <span class="a">auto-narrate</span>
+<span class="k">&gt;&lt;/page-agent&gt;</span></pre>
</div>
</div>
- </article>
+ </div>
+ </article>
- <!-- 5. Token / Crypto Widget -->
- <article class="card" data-cat="crypto">
- <div class="card-preview">
- <div class="card-preview-bg" aria-hidden="true"></div>
- <div class="preview-illustration" aria-hidden="true">
- <div class="preview-icon" style="background: rgba(244,114,182,0.10); border: 1px solid rgba(244,114,182,0.2);">📊</div>
+ <!-- 5. Token Widget -->
+ <article class="card" data-cat="crypto">
+ <div class="card-preview">
+ <div class="card-preview-bg" aria-hidden="true"></div>
+ <div class="preview-illustration" aria-hidden="true">
+ <div style="display:flex;flex-direction:column;gap:10px;align-items:center;">
<div class="preview-token">
<div class="preview-token-avatar">🪙</div>
- <div class="preview-token-info">
+ <div>
<div class="preview-token-name">$THREE</div>
- <div class="preview-token-price">$0.0024 USDC</div>
- <div class="preview-token-change">↑ 12.4% today · powered by three.ws</div>
+ <div class="preview-token-price">Live price · market cap · volume</div>
+ <div class="preview-token-change">3D mascot reacts to price moves</div>
</div>
</div>
</div>
</div>
- <div class="card-body">
- <div class="card-meta">
- <span class="cat-badge crypto">Token Widget</span>
- <span class="diff-badge">Moderate</span>
- </div>
- <h2 class="card-title">Token Market Widget</h2>
- <p class="card-desc">
- Live price, chart, and market data — with a 3D mascot that reacts to price moves.
- Built for token communities and launchpad sites.
- </p>
- <div class="card-code">
- <button class="code-toggle" aria-expanded="false" aria-controls="code-crypto">
- <svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
- <path d="M2 4l4 4 4-4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
- </svg>
- <span class="code-toggle-label">Get embed code</span>
- </button>
- <div class="code-panel" id="code-crypto" role="region">
- <div class="code-header">
- <span class="code-lang">html</span>
- <button class="copy-btn" aria-label="Copy code">Copy</button>
- </div>
- <pre class="code-block" data-code><span class="c">&lt;!-- Token widget with live 3D mascot --&gt;</span>
+ <button class="try-live-btn" data-modal-widget="wdgt_demo_pumpfun" data-modal-title="Token Widget — Live Demo" aria-label="Try live demo">
+ <span style="width:6px;height:6px;border-radius:50%;background:var(--green);flex-shrink:0;" aria-hidden="true"></span>
+ Try live
+ </button>
+ </div>
+ <div class="card-body">
+ <div class="card-meta">
+ <span class="cat-badge crypto">Token Widget</span>
+ <span class="diff-badge">Moderate</span>
+ </div>
+ <h2 class="card-title">Token Market Widget</h2>
+ <p class="card-desc">Live price, chart, and market data with a 3D mascot that reacts to moves. Built for token communities and launchpad sites.</p>
+ <div class="card-code">
+ <button class="code-toggle" aria-expanded="false" aria-controls="code-crypto">
+ <svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
+ <path d="M2 4l4 4 4-4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+ </svg>
+ <span class="code-toggle-label">Get embed code</span>
+ </button>
+ <div class="code-panel" id="code-crypto" role="region">
+ <div class="code-header">
+ <span class="code-lang">html</span>
+ <button class="copy-btn" aria-label="Copy code">Copy</button>
+ </div>
+ <pre class="code-block" data-code><span class="c">&lt;!-- Live pump.fun feed widget --&gt;</span>
<span class="k">&lt;script</span>
<span class="a">src</span>=<span class="s">"https://three.ws/embed.js"</span>
- <span class="a">data-widget</span>=<span class="s">"your-widget-id"</span>
- <span class="a">data-type</span>=<span class="s">"talking-agent"</span>
+ <span class="a">data-widget</span>=<span class="s">"wdgt_demo_pumpfun"</span>
+ <span class="a">data-type</span>=<span class="s">"pumpfun-feed"</span>
<span class="a">data-width</span>=<span class="s">"420"</span>
<span class="a">data-height</span>=<span class="s">"600"</span>
<span class="a">defer</span>
<span class="k">&gt;&lt;/script&gt;</span>
-<span class="c">&lt;!-- Get your widget ID at three.ws/widgets --&gt;</span></pre>
- </div>
+<span class="c">&lt;!-- Custom widget at three.ws/widgets --&gt;</span></pre>
</div>
</div>
- </article>
+ </div>
+ </article>
- <!-- 6. MCP Server -->
- <article class="card" data-cat="mcp">
- <div class="card-preview">
- <div class="card-preview-bg" aria-hidden="true"></div>
- <div class="preview-illustration" aria-hidden="true">
- <div class="preview-icon" style="background: rgba(167,139,250,0.08); border: 1px solid rgba(167,139,250,0.2);">⚡</div>
- <div class="preview-mcp">
- <div class="preview-mcp-tool">
- <div class="preview-mcp-tool-dot" style="background: #86efac;"></div>
- render_agent
- </div>
- <div class="preview-mcp-tool">
- <div class="preview-mcp-tool-dot" style="background: #c4b5fd;"></div>
- speak
- </div>
- <div class="preview-mcp-tool">
- <div class="preview-mcp-tool-dot" style="background: #93c5fd;"></div>
- gesture
- </div>
- <div class="preview-mcp-tool">
- <div class="preview-mcp-tool-dot" style="background: #fcd34d;"></div>
- emote
- </div>
- </div>
+ <!-- 6. MCP Server -->
+ <article class="card" data-cat="mcp">
+ <div class="card-preview">
+ <div class="card-preview-bg" aria-hidden="true"></div>
+ <div class="preview-illustration" aria-hidden="true">
+ <div class="preview-mcp">
+ <div class="preview-mcp-tool"><div class="preview-mcp-dot" style="background:#86efac"></div>render_agent</div>
+ <div class="preview-mcp-tool"><div class="preview-mcp-dot" style="background:#c4b5fd"></div>speak</div>
+ <div class="preview-mcp-tool"><div class="preview-mcp-dot" style="background:#93c5fd"></div>gesture</div>
+ <div class="preview-mcp-tool"><div class="preview-mcp-dot" style="background:#fcd34d"></div>emote</div>
</div>
</div>
- <div class="card-body">
- <div class="card-meta">
- <span class="cat-badge mcp">MCP Server</span>
- <span class="diff-badge">Advanced</span>
- </div>
- <h2 class="card-title">MCP Integration</h2>
- <p class="card-desc">
- Let any AI assistant control your 3D agents directly — render, speak, gesture,
- and emote from Claude, Cursor, or any MCP-compatible tool.
- </p>
- <div class="card-code">
- <button class="code-toggle" aria-expanded="false" aria-controls="code-mcp">
- <svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
- <path d="M2 4l4 4 4-4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
- </svg>
- <span class="code-toggle-label">Get embed code</span>
- </button>
- <div class="code-panel" id="code-mcp" role="region">
- <div class="code-header">
- <span class="code-lang">json</span>
- <button class="copy-btn" aria-label="Copy code">Copy</button>
- </div>
- <pre class="code-block" data-code><span class="c">// claude_desktop_config.json</span>
+ <a href="/docs/mcp" class="try-live-btn" target="_blank" rel="noopener">
+ <svg width="10" height="10" viewBox="0 0 10 10" fill="none" aria-hidden="true">
+ <path d="M1 9L9 1M9 1H4M9 1V6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+ </svg>
+ See docs
+ </a>
+ </div>
+ <div class="card-body">
+ <div class="card-meta">
+ <span class="cat-badge mcp">MCP Server</span>
+ <span class="diff-badge">Advanced</span>
+ </div>
+ <h2 class="card-title">MCP Integration</h2>
+ <p class="card-desc">Let Claude, Cursor, or any MCP-compatible AI assistant control your 3D agents — render, speak, gesture, and emote from your AI tools.</p>
+ <div class="card-code">
+ <button class="code-toggle" aria-expanded="false" aria-controls="code-mcp">
+ <svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
+ <path d="M2 4l4 4 4-4" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+ </svg>
+ <span class="code-toggle-label">Get embed code</span>
+ </button>
+ <div class="code-panel" id="code-mcp" role="region">
+ <div class="code-header">
+ <span class="code-lang">json</span>
+ <button class="copy-btn" aria-label="Copy code">Copy</button>
+ </div>
+ <pre class="code-block" data-code><span class="c">// claude_desktop_config.json</span>
{
<span class="a">"mcpServers"</span>: {
<span class="a">"threews-avatar"</span>: {
<span class="a">"command"</span>: <span class="s">"npx"</span>,
- <span class="a">"args"</span>: [
- <span class="s">"-y"</span>,
- <span class="s">"@three-ws/avatar-agent-mcp"</span>
- ],
+ <span class="a">"args"</span>: [<span class="s">"-y"</span>, <span class="s">"@three-ws/avatar-agent-mcp"</span>],
<span class="a">"env"</span>: {
- <span class="a">"THREEWS_API_KEY"</span>: <span class="s">"your-key"</span>
+ <span class="a">"THREEWS_API_KEY"</span>: <span class="s">"your-key-here"</span>
}
}
}
}</pre>
- </div>
</div>
</div>
- </article>
+ </div>
+ </article>
- </div><!-- /grid -->
+ </div><!-- /grid -->
- <!-- ── Showcase CTA ───────────────────────────────────── -->
- <section class="showcase">
- <p class="showcase-label">Built with three.ws</p>
- <h2 class="showcase-title">See what people are building</h2>
- <p class="showcase-sub">
- From token chat bots to 3D docs guides — these integrations are
- already live on real sites.
- </p>
- <div class="showcase-examples">
- <span class="showcase-example-tag"><strong>PumpBot</strong> — token chat agent</span>
- <span class="showcase-example-tag"><strong>Docs guides</strong> — narrated walkthroughs</span>
- <span class="showcase-example-tag"><strong>Corner mascots</strong> — walk companions</span>
- <span class="showcase-example-tag"><strong>Agent profiles</strong> — avatar embeds</span>
- </div>
- <div class="hero-cta">
- <a href="/create" class="btn-primary">Start building</a>
- <a href="/docs/embedding" class="btn-ghost">Read the docs →</a>
- </div>
- </section>
+ <!-- ── Showcase CTA ───────────────────────────────────────── -->
+ <section class="showcase">
+ <p class="showcase-label">Built with three.ws</p>
+ <h2 class="showcase-title">See what's already live</h2>
+ <p class="showcase-sub">
+ Builders are already using these integrations on real sites —
+ from token chat bots to 3D docs guides.
+ </p>
+ <div class="showcase-tags">
+ <span class="showcase-tag"><strong>PumpBot</strong> — token chat agent</span>
+ <span class="showcase-tag"><strong>Docs guides</strong> — narrated walkthroughs</span>
+ <span class="showcase-tag"><strong>Corner mascots</strong> — walk companions</span>
+ <span class="showcase-tag"><strong>Agent profiles</strong> — avatar embeds</span>
+ </div>
+ <div class="hero-cta">
+ <a href="/create" class="btn-primary">Start building</a>
+ <a href="/docs/embedding" class="btn-ghost">Full API docs →</a>
+ </div>
+ </section>
- </div>
+</div>
</main>
-<!-- ── Footer ────────────────────────────────────────────── -->
+<!-- ── Live demo modal ─────────────────────────────────────── -->
+<div class="modal-backdrop" id="demo-modal" role="dialog" aria-modal="true" aria-labelledby="modal-title-text">
+ <div class="modal">
+ <div class="modal-header">
+ <div class="modal-title">
+ <span class="modal-live-dot" aria-hidden="true"></span>
+ <span id="modal-title-text">Live Demo</span>
+ </div>
+ <button class="modal-close" id="modal-close-btn" aria-label="Close demo">
+ <svg width="14" height="14" viewBox="0 0 14 14" fill="none">
+ <path d="M2 2l10 10M12 2L2 12" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
+ </svg>
+ </button>
+ </div>
+ <div class="modal-body">
+ <iframe id="demo-iframe" title="Live widget demo" allow="autoplay; microphone" sandbox="allow-scripts allow-same-origin allow-forms allow-popups"></iframe>
+ </div>
+ </div>
+</div>
+
+<!-- ── Footer ─────────────────────────────────────────────── -->
<footer class="h-footer h-footer-horizon">
<div class="h-footer-glow-line" aria-hidden="true"></div>
<div class="h-footer-floor" aria-hidden="true"></div>
@@ -1073,20 +1251,16 @@
// ── Filter chips ──────────────────────────────────────────
const chips = document.querySelectorAll('.filter-chip');
const cards = document.querySelectorAll('#integration-grid .card');
-
chips.forEach(chip => {
chip.addEventListener('click', () => {
chips.forEach(c => c.classList.remove('active'));
chip.classList.add('active');
const filter = chip.dataset.filter;
- cards.forEach(card => {
- const match = filter === 'all' || card.dataset.cat === filter;
- card.hidden = !match;
- });
+ cards.forEach(card => { card.hidden = filter !== 'all' && card.dataset.cat !== filter; });
});
});
- // ── Code toggle expand/collapse ───────────────────────────
+ // ── Code toggle ───────────────────────────────────────────
document.querySelectorAll('.code-toggle').forEach(btn => {
btn.addEventListener('click', () => {
const expanded = btn.getAttribute('aria-expanded') === 'true';
@@ -1099,21 +1273,46 @@
// ── Copy buttons ──────────────────────────────────────────
document.querySelectorAll('.copy-btn').forEach(btn => {
btn.addEventListener('click', async () => {
- const pre = btn.closest('.code-panel').querySelector('[data-code]');
+ const pre = btn.closest('.code-panel')?.querySelector('[data-code]');
if (!pre) return;
try {
await navigator.clipboard.writeText(pre.innerText.trim());
btn.textContent = 'Copied!';
btn.classList.add('copied');
- setTimeout(() => {
- btn.textContent = 'Copy';
- btn.classList.remove('copied');
- }, 2000);
- } catch {
- btn.textContent = 'Error';
- }
+ setTimeout(() => { btn.textContent = 'Copy'; btn.classList.remove('copied'); }, 2000);
+ } catch { btn.textContent = 'Error'; }
});
});
+
+ // ── Live demo modal ───────────────────────────────────────
+ const modal = document.getElementById('demo-modal');
+ const modalIframe = document.getElementById('demo-iframe');
+ const modalTitle = document.getElementById('modal-title-text');
+ const modalClose = document.getElementById('modal-close-btn');
+ const ORIGIN = location.origin;
+
+ function openModal(widgetId, title) {
+ modalTitle.textContent = title || 'Live Demo';
+ modalIframe.src = ORIGIN + '/widget#widget=' + encodeURIComponent(widgetId) + '&kiosk=true&embedded=1';
+ modal.classList.add('open');
+ document.body.style.overflow = 'hidden';
+ modalClose.focus();
+ }
+
+ function closeModal() {
+ modal.classList.remove('open');
+ document.body.style.overflow = '';
+ // Clear iframe after transition to stop audio/WebGL
+ setTimeout(() => { modalIframe.src = 'about:blank'; }, 250);
+ }
+
+ document.querySelectorAll('[data-modal-widget]').forEach(btn => {
+ btn.addEventListener('click', () => openModal(btn.dataset.modalWidget, btn.dataset.modalTitle));
+ });
+
+ modalClose.addEventListener('click', closeModal);
+ modal.addEventListener('click', e => { if (e.target === modal) closeModal(); });
+ document.addEventListener('keydown', e => { if (e.key === 'Escape' && modal.classList.contains('open')) closeModal(); });
</script>
</body>
diff --git a/pages/marketplace.html b/pages/marketplace.html
index 4eaa86c73..2c419a52a 100644
--- a/pages/marketplace.html
+++ b/pages/marketplace.html
@@ -2260,6 +2260,204 @@
.market-pulse-label span:not(.market-pulse-dot) { display: none; }
}
+ /* ── Top Performers podium ────────────────────────────────────── */
+ .mkt-top-section {
+ margin: 0 0 20px;
+ }
+ .mkt-top-head {
+ display: flex;
+ align-items: baseline;
+ gap: 10px;
+ margin-bottom: 12px;
+ flex-wrap: wrap;
+ }
+ .mkt-top-eyebrow {
+ font-size: 10px;
+ font-weight: 700;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ color: var(--text-3);
+ padding: 3px 8px;
+ border: 1px solid var(--stroke);
+ border-radius: 999px;
+ }
+ .mkt-top-title {
+ font-size: 14px;
+ font-weight: 700;
+ color: var(--text);
+ margin: 0;
+ letter-spacing: -0.01em;
+ }
+ .mkt-top-see-all {
+ margin-left: auto;
+ font-size: 12px;
+ color: var(--text-3);
+ text-decoration: none;
+ transition: color 0.15s;
+ }
+ .mkt-top-see-all:hover { color: var(--text); }
+ .mkt-top-podium {
+ display: grid;
+ grid-template-columns: repeat(3, 1fr);
+ gap: 10px;
+ }
+ .mkt-top-card {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ padding: 20px 16px 18px;
+ border-radius: 14px;
+ border: 1px solid var(--stroke);
+ background: var(--surface-1);
+ text-decoration: none;
+ cursor: pointer;
+ position: relative;
+ overflow: hidden;
+ transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
+ gap: 2px;
+ }
+ .mkt-top-card::before {
+ content: '';
+ position: absolute;
+ top: 0; left: 0; right: 0;
+ height: 3px;
+ background: var(--rank-color, #6b7280);
+ opacity: 0.9;
+ }
+ .mkt-top-card::after {
+ content: '';
+ position: absolute;
+ top: 0; left: 0; right: 0; bottom: 0;
+ background: radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--rank-color, #6b7280) 8%, transparent), transparent 60%);
+ pointer-events: none;
+ }
+ .mkt-top-card:hover {
+ border-color: color-mix(in srgb, var(--rank-color, #6b7280) 40%, transparent);
+ transform: translateY(-3px);
+ box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
+ }
+ .mkt-top-card:focus-visible {
+ outline: 2px solid var(--rank-color, #fff);
+ outline-offset: 2px;
+ }
+ .mkt-top-rank {
+ position: absolute;
+ top: 12px;
+ left: 12px;
+ font-size: 11px;
+ font-weight: 800;
+ color: var(--rank-color, #6b7280);
+ letter-spacing: 0.04em;
+ z-index: 1;
+ }
+ .mkt-top-av-wrap {
+ width: 52px;
+ height: 52px;
+ border-radius: 50%;
+ overflow: hidden;
+ border: 2px solid color-mix(in srgb, var(--rank-color, #6b7280) 40%, transparent);
+ margin-bottom: 10px;
+ margin-top: 4px;
+ flex-shrink: 0;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ background: var(--surface-2);
+ z-index: 1;
+ }
+ .mkt-top-avatar {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ display: block;
+ }
+ .mkt-top-avatar-fallback {
+ font-size: 20px;
+ font-weight: 700;
+ color: var(--rank-color, #6b7280);
+ line-height: 1;
+ text-transform: uppercase;
+ }
+ .mkt-top-name {
+ font-size: 12px;
+ font-weight: 600;
+ color: var(--text-2);
+ text-align: center;
+ max-width: 100%;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ z-index: 1;
+ }
+ .mkt-top-wr {
+ font-size: 28px;
+ font-weight: 800;
+ color: var(--rank-color, #6b7280);
+ letter-spacing: -0.03em;
+ line-height: 1.1;
+ margin-top: 8px;
+ z-index: 1;
+ }
+ .mkt-top-wr-lbl {
+ font-size: 10px;
+ font-weight: 500;
+ text-transform: uppercase;
+ letter-spacing: 0.06em;
+ color: var(--text-3);
+ margin-bottom: 8px;
+ z-index: 1;
+ }
+ .mkt-top-meta {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 3px;
+ font-size: 11px;
+ color: var(--text-3);
+ z-index: 1;
+ }
+ .mkt-top-pnl.pos { color: #34d399; }
+ .mkt-top-pnl.neg { color: #f87171; }
+ /* Skeleton states */
+ .mkt-top-card.mkt-skel .mkt-top-av-wrap,
+ .mkt-top-card.mkt-skel .mkt-top-name,
+ .mkt-top-card.mkt-skel .mkt-top-wr,
+ .mkt-top-card.mkt-skel .mkt-top-wr-lbl,
+ .mkt-top-card.mkt-skel .mkt-top-meta {
+ background: var(--surface-2);
+ color: transparent;
+ border-radius: 6px;
+ background-image: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3, #1e1e1e) 50%, var(--surface-2) 100%);
+ background-size: 200% 100%;
+ animation: mkt-skel-shimmer 1.4s ease-in-out infinite;
+ }
+ .mkt-top-card.mkt-skel .mkt-top-av-wrap { border: none; border-radius: 50%; }
+ @keyframes mkt-skel-shimmer {
+ 0% { background-position: 200% 0; }
+ 100% { background-position: -200% 0; }
+ }
+ @media (max-width: 640px) {
+ .mkt-top-podium { grid-template-columns: 1fr; gap: 8px; }
+ .mkt-top-card { flex-direction: row; align-items: center; padding: 14px 16px; gap: 12px; }
+ .mkt-top-card::after { background: none; }
+ .mkt-top-av-wrap { margin: 0; width: 42px; height: 42px; }
+ .mkt-top-rank { position: static; }
+ .mkt-top-wr { font-size: 20px; margin-top: 0; }
+ .mkt-top-wr-lbl { margin-bottom: 0; }
+ .mkt-top-card .mkt-top-name,
+ .mkt-top-card .mkt-top-wr,
+ .mkt-top-card .mkt-top-wr-lbl,
+ .mkt-top-card .mkt-top-meta { text-align: left; }
+ }
+ @media (prefers-reduced-motion: reduce) {
+ .mkt-top-card.mkt-skel .mkt-top-av-wrap,
+ .mkt-top-card.mkt-skel .mkt-top-name,
+ .mkt-top-card.mkt-skel .mkt-top-wr,
+ .mkt-top-card.mkt-skel .mkt-top-wr-lbl,
+ .mkt-top-card.mkt-skel .mkt-top-meta { animation: none; }
+ .mkt-top-card { transition: none; }
+ }
+
/* ── Platform activity strip ──────────────────────────────────── */
.market-activity-strip {
display: flex;
@@ -3184,6 +3382,16 @@
</div>
</div>
+ <!-- Top Oracle Performers — top 3 agents by oracle win rate -->
+ <section class="mkt-top-section" id="mkt-top-section" hidden aria-label="Top performing agents by oracle win rate">
+ <div class="mkt-top-head">
+ <span class="mkt-top-eyebrow">Oracle leaders</span>
+ <h2 class="mkt-top-title">Top Performers</h2>
+ <a href="/oracle" class="mkt-top-see-all">View leaderboard →</a>
+ </div>
+ <div class="mkt-top-podium" id="mkt-top-podium"></div>
+ </section>
+
<aside
class="market-pulse"
id="market-pulse"
diff --git a/pages/partners.html b/pages/partners.html
new file mode 100644
index 000000000..1f64d2a2f
--- /dev/null
+++ b/pages/partners.html
@@ -0,0 +1,685 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <style>[hidden]{display:none!important}</style>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
+ <title>Partner Ecosystem — three.ws</title>
+ <meta name="description" content="three.ws partners with the world's leading cloud and AI platforms — AWS, IBM, Google Cloud, Alibaba Cloud, Intel, NVIDIA, and Microsoft — to bring 3D AI agents to enterprise scale." />
+ <link rel="canonical" href="https://three.ws/partners" />
+ <meta property="og:type" content="website" />
+ <meta property="og:title" content="Partner Ecosystem — three.ws" />
+ <meta property="og:description" content="Cloud and AI partnerships powering three.ws — AWS, IBM, Google Cloud, Alibaba Cloud, Intel, NVIDIA, Microsoft." />
+ <meta property="og:url" content="https://three.ws/partners" />
+ <meta property="og:image" content="https://three.ws/og-image.png" />
+ <meta name="twitter:card" content="summary_large_image" />
+ <meta name="twitter:title" content="Partner Ecosystem — three.ws" />
+ <meta name="twitter:description" content="Cloud and AI partnerships powering three.ws." />
+ <meta name="twitter:image" content="https://three.ws/og-image.png" />
+ <link rel="icon" href="/favicon.ico" />
+ <link rel="stylesheet" href="/nav.css" />
+ <link rel="stylesheet" href="/footer.css" />
+ <style>
+ :root {
+ --bg: #060611;
+ --surface: #0d0d1a;
+ --surface2: #12121f;
+ --border: rgba(255,255,255,.07);
+ --border-hover: rgba(255,255,255,.14);
+ --text: #e7e7f5;
+ --muted: #7a85a8;
+ --dim: #4a5270;
+ --accent: #9ad4ff;
+ --accent-glow: rgba(154,212,255,.15);
+ --green: #22c55e;
+ --green-glow: rgba(34,197,94,.12);
+ --aws: #ff9900;
+ --ibm: #0f62fe;
+ --gcp: #4285f4;
+ --alibaba: #ff6a00;
+ --intel: #0071c5;
+ --nvidia: #76b900;
+ --microsoft: #00a4ef;
+ --oracle: #f80000;
+ }
+ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
+ body {
+ font: 16px/1.6 -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
+ color: var(--text);
+ background: var(--bg);
+ min-height: 100vh;
+ -webkit-font-smoothing: antialiased;
+ }
+
+ /* ── Hero ─────────────────────────────────────────────── */
+ .hero {
+ max-width: 960px;
+ margin: 0 auto;
+ padding: 96px 24px 64px;
+ text-align: center;
+ }
+ .hero-eyebrow {
+ display: inline-flex;
+ align-items: center;
+ gap: 8px;
+ font-size: 12px;
+ font-weight: 600;
+ letter-spacing: .1em;
+ text-transform: uppercase;
+ color: var(--accent);
+ margin-bottom: 20px;
+ }
+ .hero-eyebrow::before, .hero-eyebrow::after {
+ content: '';
+ display: block;
+ width: 32px;
+ height: 1px;
+ background: var(--accent);
+ opacity: .4;
+ }
+ .hero h1 {
+ font-size: clamp(36px, 6vw, 60px);
+ font-weight: 700;
+ letter-spacing: -.03em;
+ line-height: 1.05;
+ margin-bottom: 20px;
+ }
+ .hero h1 em {
+ font-style: normal;
+ background: linear-gradient(120deg, #9ad4ff 0%, #c084fc 50%, #9ad4ff 100%);
+ background-size: 200% auto;
+ -webkit-background-clip: text;
+ background-clip: text;
+ color: transparent;
+ animation: shimmer 4s linear infinite;
+ }
+ @keyframes shimmer { to { background-position: 200% center; } }
+ .hero p {
+ font-size: clamp(16px, 2vw, 18px);
+ color: var(--muted);
+ max-width: 580px;
+ margin: 0 auto 40px;
+ line-height: 1.65;
+ }
+
+ /* ── Stats bar ────────────────────────────────────────── */
+ .stats {
+ display: flex;
+ justify-content: center;
+ gap: 0;
+ border: 1px solid var(--border);
+ border-radius: 16px;
+ overflow: hidden;
+ max-width: 640px;
+ margin: 0 auto 80px;
+ background: var(--surface);
+ }
+ .stat {
+ flex: 1;
+ padding: 20px 24px;
+ border-right: 1px solid var(--border);
+ text-align: center;
+ }
+ .stat:last-child { border-right: none; }
+ .stat-num {
+ font-size: 28px;
+ font-weight: 700;
+ letter-spacing: -.02em;
+ color: var(--text);
+ }
+ .stat-label {
+ font-size: 12px;
+ color: var(--muted);
+ margin-top: 2px;
+ text-transform: uppercase;
+ letter-spacing: .06em;
+ }
+
+ /* ── Section headers ──────────────────────────────────── */
+ .section {
+ max-width: 1100px;
+ margin: 0 auto;
+ padding: 0 24px 80px;
+ }
+ .section-header {
+ display: flex;
+ align-items: center;
+ gap: 16px;
+ margin-bottom: 32px;
+ }
+ .section-title {
+ font-size: 13px;
+ font-weight: 600;
+ letter-spacing: .08em;
+ text-transform: uppercase;
+ color: var(--muted);
+ }
+ .section-line {
+ flex: 1;
+ height: 1px;
+ background: var(--border);
+ }
+
+ /* ── Partner grid ─────────────────────────────────────── */
+ .partner-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
+ gap: 16px;
+ }
+ .partner-card {
+ background: var(--surface);
+ border: 1px solid var(--border);
+ border-radius: 18px;
+ padding: 28px;
+ text-decoration: none;
+ color: inherit;
+ display: flex;
+ flex-direction: column;
+ gap: 16px;
+ transition: border-color .2s, box-shadow .2s, transform .15s;
+ position: relative;
+ overflow: hidden;
+ }
+ .partner-card::before {
+ content: '';
+ position: absolute;
+ inset: 0;
+ border-radius: inherit;
+ background: radial-gradient(ellipse at 0% 0%, var(--card-glow, transparent) 0%, transparent 70%);
+ opacity: 0;
+ transition: opacity .3s;
+ pointer-events: none;
+ }
+ .partner-card:hover {
+ border-color: var(--border-hover);
+ box-shadow: 0 8px 40px rgba(0,0,0,.4);
+ transform: translateY(-2px);
+ }
+ .partner-card:hover::before { opacity: 1; }
+
+ .card-top {
+ display: flex;
+ align-items: flex-start;
+ justify-content: space-between;
+ gap: 12px;
+ }
+ .partner-logo {
+ width: 44px;
+ height: 44px;
+ border-radius: 12px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 20px;
+ font-weight: 800;
+ letter-spacing: -.03em;
+ flex-shrink: 0;
+ border: 1px solid rgba(255,255,255,.08);
+ }
+ .badge-row {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 6px;
+ justify-content: flex-end;
+ }
+ .badge {
+ display: inline-flex;
+ align-items: center;
+ gap: 5px;
+ padding: 3px 9px;
+ border-radius: 999px;
+ font-size: 11px;
+ font-weight: 600;
+ letter-spacing: .02em;
+ border: 1px solid transparent;
+ }
+ .badge-active {
+ background: var(--green-glow);
+ border-color: rgba(34,197,94,.2);
+ color: var(--green);
+ }
+ .badge-active::before {
+ content: '';
+ width: 5px;
+ height: 5px;
+ border-radius: 50%;
+ background: var(--green);
+ box-shadow: 0 0 6px var(--green);
+ }
+ .badge-tier {
+ background: rgba(255,255,255,.04);
+ border-color: var(--border);
+ color: var(--muted);
+ }
+
+ .partner-name {
+ font-size: 18px;
+ font-weight: 700;
+ letter-spacing: -.01em;
+ color: var(--text);
+ }
+ .partner-program {
+ font-size: 13px;
+ color: var(--muted);
+ margin-top: 1px;
+ }
+ .partner-desc {
+ font-size: 14px;
+ color: var(--muted);
+ line-height: 1.6;
+ flex: 1;
+ }
+ .partner-desc strong { color: var(--text); font-weight: 500; }
+
+ .partner-powers {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 6px;
+ }
+ .power-chip {
+ padding: 3px 10px;
+ border-radius: 6px;
+ background: rgba(255,255,255,.04);
+ border: 1px solid var(--border);
+ font-size: 12px;
+ color: var(--muted);
+ }
+
+ .card-cta {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ font-size: 13px;
+ font-weight: 500;
+ padding-top: 4px;
+ border-top: 1px solid var(--border);
+ transition: color .15s;
+ }
+ .card-cta svg {
+ width: 14px;
+ height: 14px;
+ transition: transform .15s;
+ }
+ .partner-card:hover .card-cta svg { transform: translateX(3px); }
+
+ /* Partner accent colours */
+ .aws-card { --card-glow: rgba(255,153,0,.06); }
+ .aws-card .partner-logo { background: rgba(255,153,0,.1); color: var(--aws); }
+ .aws-card .card-cta { color: var(--aws); }
+
+ .ibm-card { --card-glow: rgba(15,98,254,.08); }
+ .ibm-card .partner-logo { background: rgba(15,98,254,.12); color: var(--ibm); }
+ .ibm-card .card-cta { color: var(--ibm); }
+
+ .gcp-card { --card-glow: rgba(66,133,244,.06); }
+ .gcp-card .partner-logo { background: rgba(66,133,244,.1); color: var(--gcp); }
+ .gcp-card .card-cta { color: var(--gcp); }
+
+ .alibaba-card { --card-glow: rgba(255,106,0,.06); }
+ .alibaba-card .partner-logo { background: rgba(255,106,0,.1); color: var(--alibaba); }
+ .alibaba-card .card-cta { color: var(--alibaba); }
+
+ .intel-card { --card-glow: rgba(0,113,197,.06); }
+ .intel-card .partner-logo { background: rgba(0,113,197,.1); color: var(--intel); }
+ .intel-card .card-cta { color: var(--intel); }
+
+ .nvidia-card { --card-glow: rgba(118,185,0,.06); }
+ .nvidia-card .partner-logo { background: rgba(118,185,0,.1); color: var(--nvidia); }
+ .nvidia-card .card-cta { color: var(--nvidia); }
+
+ .microsoft-card { --card-glow: rgba(0,164,239,.06); }
+ .microsoft-card .partner-logo { background: rgba(0,164,239,.1); color: var(--microsoft); }
+ .microsoft-card .card-cta { color: var(--microsoft); }
+
+ .oracle-card { --card-glow: rgba(248,0,0,.05); }
+ .oracle-card .partner-logo { background: rgba(248,0,0,.08); color: var(--oracle); }
+ .oracle-card .card-cta { color: var(--oracle); }
+
+ /* ── MCP CTA section ──────────────────────────────────── */
+ .mcp-section {
+ max-width: 960px;
+ margin: 0 auto;
+ padding: 0 24px 100px;
+ }
+ .mcp-banner {
+ border: 1px solid var(--border);
+ border-radius: 20px;
+ padding: 40px;
+ background: var(--surface);
+ display: flex;
+ align-items: center;
+ gap: 32px;
+ flex-wrap: wrap;
+ }
+ .mcp-banner-text { flex: 1; min-width: 240px; }
+ .mcp-banner h2 {
+ font-size: 22px;
+ font-weight: 700;
+ letter-spacing: -.02em;
+ margin-bottom: 8px;
+ }
+ .mcp-banner p { font-size: 14px; color: var(--muted); line-height: 1.6; }
+ .mcp-servers {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 8px;
+ }
+ .mcp-chip {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ padding: 6px 12px;
+ border-radius: 8px;
+ background: rgba(255,255,255,.04);
+ border: 1px solid var(--border);
+ font-size: 12px;
+ font-family: ui-monospace, "SF Mono", Menlo, monospace;
+ color: var(--accent);
+ text-decoration: none;
+ transition: background .15s, border-color .15s;
+ }
+ .mcp-chip:hover { background: var(--accent-glow); border-color: rgba(154,212,255,.2); }
+ .mcp-chip-dot {
+ width: 6px; height: 6px;
+ border-radius: 50%;
+ background: currentColor;
+ }
+
+ @media (max-width: 640px) {
+ .stats { flex-direction: column; max-width: 280px; }
+ .stat { border-right: none; border-bottom: 1px solid var(--border); }
+ .stat:last-child { border-bottom: none; }
+ .mcp-banner { padding: 28px 20px; }
+ }
+ </style>
+</head>
+<body>
+<div id="nav-container"></div>
+
+<main>
+ <!-- Hero -->
+ <div class="hero">
+ <div class="hero-eyebrow">Partner Ecosystem</div>
+ <h1>Built with the<br><em>world's best platforms</em></h1>
+ <p>three.ws integrates with the leading cloud, AI, and developer platforms — so every 3D agent runs on infrastructure enterprises already trust.</p>
+
+ <div class="stats">
+ <div class="stat">
+ <div class="stat-num">8</div>
+ <div class="stat-label">Active partners</div>
+ </div>
+ <div class="stat">
+ <div class="stat-num">31</div>
+ <div class="stat-label">MCP servers</div>
+ </div>
+ <div class="stat">
+ <div class="stat-num">5</div>
+ <div class="stat-label">Partner pages</div>
+ </div>
+ </div>
+ </div>
+
+ <!-- Active partnerships -->
+ <div class="section">
+ <div class="section-header">
+ <span class="section-title">Active Partnerships</span>
+ <span class="section-line"></span>
+ </div>
+
+ <div class="partner-grid">
+
+ <!-- AWS -->
+ <a class="partner-card aws-card" href="/aws">
+ <div class="card-top">
+ <div class="partner-logo">AWS</div>
+ <div class="badge-row">
+ <span class="badge badge-active">Active</span>
+ <span class="badge badge-tier">Technology Partner</span>
+ </div>
+ </div>
+ <div>
+ <div class="partner-name">Amazon Web Services</div>
+ <div class="partner-program">AWS Partner Network · Software Path</div>
+ </div>
+ <div class="partner-desc">
+ <strong>Marketplace, compute, and CDN.</strong> three.ws is an official APN Technology Partner and AWS Marketplace ISV — agents, assets, and billing run on AWS infrastructure with consolidated invoicing.
+ </div>
+ <div class="partner-powers">
+ <span class="power-chip">AWS Marketplace</span>
+ <span class="power-chip">S3 asset delivery</span>
+ <span class="power-chip">CloudFront CDN</span>
+ <span class="power-chip">Activate credits</span>
+ </div>
+ <div class="card-cta">
+ View AWS page
+ <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M3 8h10M9 4l4 4-4 4"/></svg>
+ </div>
+ </a>
+
+ <!-- IBM -->
+ <a class="partner-card ibm-card" href="/ibm/hello">
+ <div class="card-top">
+ <div class="partner-logo">IBM</div>
+ <div class="badge-row">
+ <span class="badge badge-active">Active</span>
+ <span class="badge badge-tier">Business Partner</span>
+ </div>
+ </div>
+ <div>
+ <div class="partner-name">IBM</div>
+ <div class="partner-program">IBM PartnerPlus · Business Partner</div>
+ </div>
+ <div class="partner-desc">
+ <strong>Enterprise AI backbone.</strong> IBM Granite foundation models via watsonx.ai power the agent brain. three.ws is an IBM PartnerPlus Business Partner with an MCP server published to the MCP Registry.
+ </div>
+ <div class="partner-powers">
+ <span class="power-chip">IBM Granite models</span>
+ <span class="power-chip">watsonx.ai</span>
+ <span class="power-chip">ibm-watsonx-mcp</span>
+ <span class="power-chip">ibm-x402-mcp</span>
+ </div>
+ <div class="card-cta">
+ View IBM partnership
+ <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M3 8h10M9 4l4 4-4 4"/></svg>
+ </div>
+ </a>
+
+ <!-- Google Cloud -->
+ <a class="partner-card gcp-card" href="/blog/three-ws-google-cloud-partnership">
+ <div class="card-top">
+ <div class="partner-logo">GCP</div>
+ <div class="badge-row">
+ <span class="badge badge-active">Active</span>
+ <span class="badge badge-tier">Web3 Startups</span>
+ </div>
+ </div>
+ <div>
+ <div class="partner-name">Google Cloud</div>
+ <div class="partner-program">Google Cloud for Web3 Startups</div>
+ </div>
+ <div class="partner-desc">
+ <strong>Rendering capacity and global edge.</strong> Google Cloud's Web3 Startups program expands 3D rendering throughput, AI compute, and asset delivery across Google's global network.
+ </div>
+ <div class="partner-powers">
+ <span class="power-chip">Compute credits</span>
+ <span class="power-chip">Vertex AI</span>
+ <span class="power-chip">Global CDN</span>
+ <span class="power-chip">Gemini models</span>
+ </div>
+ <div class="card-cta">
+ Read announcement
+ <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M3 8h10M9 4l4 4-4 4"/></svg>
+ </div>
+ </a>
+
+ <!-- Alibaba Cloud -->
+ <a class="partner-card alibaba-card" href="/blog/three-ws-alibaba-cloud-partnership">
+ <div class="card-top">
+ <div class="partner-logo">ALI</div>
+ <div class="badge-row">
+ <span class="badge badge-active">Active</span>
+ <span class="badge badge-tier">Partner Network</span>
+ </div>
+ </div>
+ <div>
+ <div class="partner-name">Alibaba Cloud</div>
+ <div class="partner-program">Alibaba Cloud Partner Network</div>
+ </div>
+ <div class="partner-desc">
+ <strong>Qwen models and Asia-Pacific reach.</strong> Alibaba Cloud's DashScope API brings Qwen foundation models — qwen-max, qwen-plus, qwen-long — to the three.ws agent brain, with APAC compute and edge delivery.
+ </div>
+ <div class="partner-powers">
+ <span class="power-chip">Qwen models</span>
+ <span class="power-chip">DashScope API</span>
+ <span class="power-chip">alibaba-cloud-mcp</span>
+ <span class="power-chip">APAC edge</span>
+ </div>
+ <div class="card-cta">
+ Read announcement
+ <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M3 8h10M9 4l4 4-4 4"/></svg>
+ </div>
+ </a>
+
+ <!-- Intel -->
+ <a class="partner-card intel-card" href="/blog">
+ <div class="card-top">
+ <div class="partner-logo">INT</div>
+ <div class="badge-row">
+ <span class="badge badge-active">Active</span>
+ <span class="badge badge-tier">Partner Alliance</span>
+ </div>
+ </div>
+ <div>
+ <div class="partner-name">Intel</div>
+ <div class="partner-program">Intel Partner Alliance</div>
+ </div>
+ <div class="partner-desc">
+ <strong>Hardware-optimised inference.</strong> Intel Partner Alliance membership brings hardware-level inference optimization for three.ws's WebGL rendering and AI inference pipelines.
+ </div>
+ <div class="partner-powers">
+ <span class="power-chip">GPU inference</span>
+ <span class="power-chip">intel-mcp</span>
+ <span class="power-chip">DL training credits</span>
+ </div>
+ <div class="card-cta">
+ Learn more
+ <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M3 8h10M9 4l4 4-4 4"/></svg>
+ </div>
+ </a>
+
+ <!-- NVIDIA -->
+ <a class="partner-card nvidia-card" href="/blog">
+ <div class="card-top">
+ <div class="partner-logo">NV</div>
+ <div class="badge-row">
+ <span class="badge badge-active">Active</span>
+ <span class="badge badge-tier">Inception</span>
+ </div>
+ </div>
+ <div>
+ <div class="partner-name">NVIDIA</div>
+ <div class="partner-program">NVIDIA Inception Program</div>
+ </div>
+ <div class="partner-desc">
+ <strong>GPU compute and AI acceleration.</strong> NVIDIA Inception provides GPU compute credits and AI acceleration for training, rendering, and real-time inference across the three.ws platform.
+ </div>
+ <div class="partner-powers">
+ <span class="power-chip">Nebius AI credits</span>
+ <span class="power-chip">DGX Cloud discount</span>
+ <span class="power-chip">DL training credits</span>
+ </div>
+ <div class="card-cta">
+ Learn more
+ <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M3 8h10M9 4l4 4-4 4"/></svg>
+ </div>
+ </a>
+
+ <!-- Microsoft -->
+ <a class="partner-card microsoft-card" href="/blog">
+ <div class="card-top">
+ <div class="partner-logo">MS</div>
+ <div class="badge-row">
+ <span class="badge badge-active">Active</span>
+ <span class="badge badge-tier">AI Cloud Partner</span>
+ </div>
+ </div>
+ <div>
+ <div class="partner-name">Microsoft</div>
+ <div class="partner-program">Microsoft AI Cloud Partner Program</div>
+ </div>
+ <div class="partner-desc">
+ <strong>Azure AI and enterprise co-selling.</strong> Microsoft AI Cloud Partner Program membership enables Azure AI integrations, co-selling motions, and access to the Azure Marketplace channel.
+ </div>
+ <div class="partner-powers">
+ <span class="power-chip">Azure AI</span>
+ <span class="power-chip">Co-selling</span>
+ <span class="power-chip">Partner Center</span>
+ </div>
+ <div class="card-cta">
+ Learn more
+ <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M3 8h10M9 4l4 4-4 4"/></svg>
+ </div>
+ </a>
+
+ <!-- Oracle -->
+ <a class="partner-card oracle-card" href="/blog">
+ <div class="card-top">
+ <div class="partner-logo">OCI</div>
+ <div class="badge-row">
+ <span class="badge badge-active">Active</span>
+ <span class="badge badge-tier">Partner Network</span>
+ </div>
+ </div>
+ <div>
+ <div class="partner-name">Oracle</div>
+ <div class="partner-program">Oracle Partner Network</div>
+ </div>
+ <div class="partner-desc">
+ <strong>OCI compute and enterprise database.</strong> Oracle Partner Network provides OCI compute access and enterprise-grade infrastructure for three.ws's backend services.
+ </div>
+ <div class="partner-powers">
+ <span class="power-chip">OCI compute</span>
+ <span class="power-chip">Always Free tier</span>
+ <span class="power-chip">Enterprise infra</span>
+ </div>
+ <div class="card-cta">
+ Learn more
+ <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><path d="M3 8h10M9 4l4 4-4 4"/></svg>
+ </div>
+ </a>
+
+ </div>
+ </div>
+
+ <!-- MCP servers section -->
+ <div class="mcp-section">
+ <div class="mcp-banner">
+ <div class="mcp-banner-text">
+ <h2>Partner MCP servers</h2>
+ <p>Every major partnership ships as a published MCP server — wire any partner's AI directly into Claude Code, Cursor, or any MCP-compatible agent in one command.</p>
+ </div>
+ <div class="mcp-servers">
+ <a class="mcp-chip" href="https://www.npmjs.com/package/@three-ws/ibm-watsonx-mcp" rel="noopener noreferrer">
+ <span class="mcp-chip-dot"></span>ibm-watsonx-mcp
+ </a>
+ <a class="mcp-chip" href="https://www.npmjs.com/package/@three-ws/ibm-x402-mcp" rel="noopener noreferrer">
+ <span class="mcp-chip-dot"></span>ibm-x402-mcp
+ </a>
+ <a class="mcp-chip" href="https://www.npmjs.com/package/@three-ws/alibaba-cloud-mcp" rel="noopener noreferrer">
+ <span class="mcp-chip-dot"></span>alibaba-cloud-mcp
+ </a>
+ <a class="mcp-chip" href="https://www.npmjs.com/package/@three-ws/intel-mcp" rel="noopener noreferrer">
+ <span class="mcp-chip-dot"></span>intel-mcp
+ </a>
+ <a class="mcp-chip" href="/docs/mcp" rel="noopener noreferrer">
+ <span class="mcp-chip-dot"></span>+27 more
+ </a>
+ </div>
+ </div>
+ </div>
+</main>
+
+<div id="footer-container"></div>
+<script src="/nav.js"></script>
+</body>
+</html>
diff --git a/scripts/audit-page-index.mjs b/scripts/audit-page-index.mjs
index dc67658a9..28d65413e 100644
--- a/scripts/audit-page-index.mjs
+++ b/scripts/audit-page-index.mjs
@@ -49,6 +49,7 @@ const IGNORE = new Set([
'/deploy', // post-create deploy step, reached in-flow
'/demos', // internal demo index
'/x402', // authenticated x402 checkout, not a discovery page
+ '/billing/keys', // authenticated x402 subscription-key management, reached in-flow from AWS welcome + dashboard
'/cz', // internal alias
'/app-classic', // legacy build of /app, superseded by the current viewer
'/create/studio', // editor shell reached in-flow from /create, not a landing
diff --git a/src/agent-screen.js b/src/agent-screen.js
index f88c30b43..c48105660 100644
--- a/src/agent-screen.js
+++ b/src/agent-screen.js
@@ -42,12 +42,283 @@ const agentLinkEl = document.getElementById('asc-agent-link');
const fsBtn = document.getElementById('asc-fullscreen-btn');
if (!agentId) {
- // noAgentEl already visible from HTML
+ renderSetup();
} else {
noAgentEl.style.display = 'none';
boot(agentId);
}
+// ── Worker Setup Panel ─────────────────────────────────────────────────────
+// Rendered when no agentId is in the URL. Walks through:
+// 1. Pick an agent (shows UUIDs)
+// 2. Generate an API key (used as AGENT_JWT)
+// 3. Copy the exact run command
+
+async function renderSetup() {
+ // Update header to reflect setup mode
+ document.title = 'Launch Worker · Agent Screen · three.ws';
+ document.getElementById('asc-agent-name').textContent = 'Worker Setup';
+ document.getElementById('asc-live-badge').style.display = 'none';
+ document.getElementById('asc-fullscreen-btn').style.display = 'none';
+ document.getElementById('asc-agent-link').style.display = 'none';
+
+ const container = noAgentEl;
+ container.className = 'ws-setup';
+ container.style.display = 'flex';
+
+ let selectedAgent = null; // { id, name }
+ let apiKey = null; // 'sk_live_...'
+ let activeTab = 'local';
+
+ // ── Check auth ─────────────────────────────────────────────────────────
+ let agents = [];
+ let isSignedIn = false;
+ try {
+ const r = await fetch('/api/agents', { credentials: 'include' });
+ if (r.ok) {
+ const j = await r.json();
+ agents = j.agents || j.data || [];
+ isSignedIn = true;
+ } else if (r.status === 401) {
+ isSignedIn = false;
+ }
+ } catch { /* network error — treat as signed-out */ }
+
+ // ── Render ─────────────────────────────────────────────────────────────
+ function buildCommand() {
+ const id = selectedAgent?.id || '<AGENT_ID>';
+ const key = apiKey || '<AGENT_JWT>';
+ const url = location.origin;
+ if (activeTab === 'local') {
+ return [
+ `<span class="cmd-comment"># workers/agent-screen-worker/</span>`,
+ `<span class="cmd-key">AGENT_ID</span>=<span class="cmd-val">${esc(id)}</span> \\`,
+ `<span class="cmd-key">AGENT_JWT</span>=<span class="cmd-val">${esc(key)}</span> \\`,
+ `<span class="cmd-key">PUSH_URL</span>=<span class="cmd-val">${esc(url)}/api/agent-screen-push</span> \\`,
+ `<span class="cmd-run">npm start</span>`,
+ ].join('\n');
+ }
+ if (activeTab === 'docker') {
+ return [
+ `<span class="cmd-comment"># from workers/agent-screen-worker/</span>`,
+ `<span class="cmd-run">docker build</span> -t agent-screen-worker . && \\`,
+ `<span class="cmd-run">docker run</span> \\`,
+ ` -e <span class="cmd-key">AGENT_ID</span>=<span class="cmd-val">${esc(id)}</span> \\`,
+ ` -e <span class="cmd-key">AGENT_JWT</span>=<span class="cmd-val">${esc(key)}</span> \\`,
+ ` -e <span class="cmd-key">PUSH_URL</span>=<span class="cmd-val">${esc(url)}/api/agent-screen-push</span> \\`,
+ ` agent-screen-worker`,
+ ].join('\n');
+ }
+ // browserbase
+ return [
+ `<span class="cmd-comment"># workers/agent-screen-worker/ — no Docker needed</span>`,
+ `<span class="cmd-key">AGENT_ID</span>=<span class="cmd-val">${esc(id)}</span> \\`,
+ `<span class="cmd-key">AGENT_JWT</span>=<span class="cmd-val">${esc(key)}</span> \\`,
+ `<span class="cmd-key">PUSH_URL</span>=<span class="cmd-val">${esc(url)}/api/agent-screen-push</span> \\`,
+ `<span class="cmd-key">BROWSERBASE_API_KEY</span>=<span class="cmd-val">&lt;your-bb-key&gt;</span> \\`,
+ `<span class="cmd-key">BROWSERBASE_PROJECT_ID</span>=<span class="cmd-val">&lt;your-bb-project&gt;</span> \\`,
+ `<span class="cmd-run">npm start</span>`,
+ ].join('\n');
+ }
+
+ function buildRawCommand() {
+ const id = selectedAgent?.id || '';
+ const key = apiKey || '';
+ const url = location.origin;
+ if (activeTab === 'local') {
+ return `AGENT_ID=${id} AGENT_JWT=${key} PUSH_URL=${url}/api/agent-screen-push npm start`;
+ }
+ if (activeTab === 'docker') {
+ return `docker build -t agent-screen-worker . && docker run -e AGENT_ID=${id} -e AGENT_JWT=${key} -e PUSH_URL=${url}/api/agent-screen-push agent-screen-worker`;
+ }
+ return `AGENT_ID=${id} AGENT_JWT=${key} PUSH_URL=${url}/api/agent-screen-push BROWSERBASE_API_KEY=<key> BROWSERBASE_PROJECT_ID=<id> npm start`;
+ }
+
+ function agentCardHTML(a) {
+ const initials = (a.name || '?').slice(0, 2).toUpperCase();
+ const thumbUrl = a.avatar_thumbnail_url || a.avatar_url || '';
+ const avatarEl = thumbUrl
+ ? `<img class="ws-agent-avatar" src="${esc(thumbUrl)}" alt="" loading="lazy">`
+ : `<div class="ws-agent-avatar-placeholder">${esc(initials)}</div>`;
+ const shortId = (a.id || '').slice(0, 8) + '…';
+ return `<button class="ws-agent-card${selectedAgent?.id === a.id ? ' selected' : ''}" data-id="${esc(a.id)}" data-name="${esc(a.name || 'Agent')}">
+ ${avatarEl}
+ <div class="ws-agent-info">
+ <div class="ws-agent-name">${esc(a.name || 'Agent')}</div>
+ <div class="ws-agent-uuid">${esc(shortId)}</div>
+ </div>
+ </button>`;
+ }
+
+ function render() {
+ const step1Done = !!selectedAgent;
+ const step2Done = !!apiKey;
+
+ container.innerHTML = `
+ <div class="ws-setup-inner">
+ <div class="ws-setup-hero">
+ <h1>Launch your browser agent</h1>
+ <p>Three steps to get a live browser stream running on your agent's screen.</p>
+ </div>
+
+ ${!isSignedIn ? `
+ <div class="ws-not-signed-in">
+ <span>⚠</span>
+ <span>You need to <a href="/login">sign in</a> to generate an API key and select an agent.</span>
+ </div>` : ''}
+
+ <!-- Step 1: Pick agent -->
+ <div class="ws-setup-step">
+ <div class="ws-setup-step-head">
+ <div class="ws-step-num${step1Done ? ' done' : ''}">${step1Done ? '✓' : '1'}</div>
+ <div>
+ <h3>${step1Done ? `Agent: ${esc(selectedAgent.name)}` : 'Select an agent'}</h3>
+ <p>${step1Done ? esc(selectedAgent.id) : 'Choose which agent will broadcast its screen'}</p>
+ </div>
+ ${step1Done ? `<button class="ws-btn ws-btn-ghost" id="ws-change-agent" style="margin-left:auto;font-size:0.75rem;padding:0.3rem 0.6rem;">Change</button>` : ''}
+ </div>
+ ${!step1Done ? `
+ <div class="ws-setup-step-body">
+ <div class="ws-agent-grid" id="ws-agent-grid">
+ ${agents.length > 0
+ ? agents.map(agentCardHTML).join('')
+ : `<div class="ws-agent-empty">
+ ${isSignedIn
+ ? `No agents yet. <a href="/agents/new">Create one →</a>`
+ : `<a href="/login">Sign in</a> to see your agents.`
+ }
+ </div>`
+ }
+ </div>
+ </div>` : ''}
+ </div>
+
+ <!-- Step 2: API key -->
+ <div class="ws-setup-step" ${!step1Done ? 'style="opacity:0.45;pointer-events:none"' : ''}>
+ <div class="ws-setup-step-head">
+ <div class="ws-step-num${step2Done ? ' done' : ''}">${step2Done ? '✓' : '2'}</div>
+ <div>
+ <h3>Generate an API key</h3>
+ <p>Used as <code style="font-size:0.78rem;color:#8a9fff">AGENT_JWT</code> — authenticates the worker as you</p>
+ </div>
+ </div>
+ <div class="ws-setup-step-body">
+ <div class="ws-key-row">
+ <div class="ws-key-display${apiKey ? '' : ' placeholder'}" id="ws-key-display">
+ ${apiKey ? esc(apiKey) : 'Click Generate to create a key'}
+ </div>
+ ${apiKey
+ ? `<button class="ws-btn ws-btn-copy" id="ws-copy-key">Copy</button>`
+ : `<button class="ws-btn ws-btn-primary" id="ws-gen-key" ${!isSignedIn ? 'disabled' : ''}>Generate</button>`
+ }
+ </div>
+ ${apiKey
+ ? `<p class="ws-key-note"><strong>Save this key now.</strong> It won't be shown again. It grants access to your account — treat it like a password.</p>`
+ : `<p class="ws-key-note">Creates a new <code style="font-size:0.78rem">agents:write</code>-scoped API key. You can manage keys at <a href="/dashboard-next/developers" style="color:#7aabff">Developers →</a></p>`
+ }
+ </div>
+ </div>
+
+ <!-- Step 3: Run command -->
+ <div class="ws-setup-step" ${!step1Done ? 'style="opacity:0.45;pointer-events:none"' : ''}>
+ <div class="ws-setup-step-head">
+ <div class="ws-step-num">${step1Done && step2Done ? '3' : '3'}</div>
+ <div>
+ <h3>Run the worker</h3>
+ <p>Copy and run in your terminal from the <code style="font-size:0.78rem;color:#8a9fff">workers/agent-screen-worker/</code> directory</p>
+ </div>
+ </div>
+ <div class="ws-setup-step-body">
+ <div class="ws-cmd-tabs">
+ <button class="ws-cmd-tab${activeTab === 'local' ? ' active' : ''}" data-tab="local">Local (npm)</button>
+ <button class="ws-cmd-tab${activeTab === 'docker' ? ' active' : ''}" data-tab="docker">Docker</button>
+ <button class="ws-cmd-tab${activeTab === 'bb' ? ' active' : ''}" data-tab="bb">Browserbase</button>
+ </div>
+ <div class="ws-cmd-block">
+ <button class="ws-btn ws-btn-copy ws-cmd-copy" id="ws-copy-cmd">Copy</button>
+ <pre id="ws-cmd-pre">${buildCommand()}</pre>
+ </div>
+ ${activeTab === 'bb' ? `<p class="ws-key-note" style="margin-top:0.7rem">Get your Browserbase key + project ID at <a href="https://browserbase.com" target="_blank" rel="noopener" style="color:#7aabff">browserbase.com</a> — no Docker needed, the browser runs in their cloud.</p>` : ''}
+ ${selectedAgent && apiKey ? `
+ <div class="ws-status-ok">
+ <span>✓</span>
+ <span>Ready. Once the worker starts, your stream will appear live below.</span>
+ </div>
+ <a class="ws-watch-link" href="/agent-screen?agentId=${esc(selectedAgent.id)}">
+ Watch live stream →
+ </a>` : ''}
+ </div>
+ </div>
+ </div>`;
+
+ // Bind events
+ container.querySelectorAll('.ws-agent-card').forEach((card) => {
+ card.addEventListener('click', () => {
+ selectedAgent = { id: card.dataset.id, name: card.dataset.name };
+ render();
+ });
+ });
+ container.querySelector('#ws-change-agent')?.addEventListener('click', () => {
+ selectedAgent = null;
+ render();
+ });
+ container.querySelector('#ws-gen-key')?.addEventListener('click', generateKey);
+ container.querySelector('#ws-copy-key')?.addEventListener('click', () => copyText(apiKey, 'ws-copy-key'));
+ container.querySelector('#ws-copy-cmd')?.addEventListener('click', () => copyText(buildRawCommand(), 'ws-copy-cmd'));
+ container.querySelectorAll('.ws-cmd-tab').forEach((tab) => {
+ tab.addEventListener('click', () => { activeTab = tab.dataset.tab; render(); });
+ });
+ }
+
+ async function generateKey() {
+ const btn = container.querySelector('#ws-gen-key');
+ if (!btn) return;
+ btn.disabled = true;
+ btn.innerHTML = '<span class="ws-spinner"></span>';
+ try {
+ const csrf = await fetch('/api/csrf-token', { credentials: 'include' })
+ .then((r) => r.json())
+ .then((j) => j.token || '')
+ .catch(() => '');
+
+ const r = await fetch('/api/api-keys', {
+ method: 'POST',
+ credentials: 'include',
+ headers: { 'content-type': 'application/json', 'x-csrf-token': csrf },
+ body: JSON.stringify({ name: 'Agent Screen Worker', scope: 'agents:write agents:read' }),
+ });
+ const j = await r.json();
+ if (r.ok && (j.data?.token || j.token)) {
+ apiKey = j.data?.token || j.token;
+ render();
+ } else {
+ btn.disabled = false;
+ btn.textContent = 'Generate';
+ console.error('[setup] key gen failed:', j);
+ }
+ } catch (err) {
+ btn.disabled = false;
+ btn.textContent = 'Generate';
+ console.error('[setup] key gen error:', err);
+ }
+ }
+
+ function copyText(text, btnId) {
+ navigator.clipboard.writeText(text).then(() => {
+ const el = container.querySelector(`#${btnId}`);
+ if (!el) return;
+ const orig = el.textContent;
+ el.textContent = 'Copied!';
+ el.classList.add('copied');
+ setTimeout(() => { el.textContent = orig; el.classList.remove('copied'); }, 1800);
+ }).catch(() => {});
+ }
+
+ render();
+}
+
+// ─────────────────────────────────────────────────────────────────────────────
+
async function boot(id) {
// Build the split-view DOM
mainEl.innerHTML = `
@@ -61,6 +332,25 @@ async function boot(id) {
<small>The agent will appear here once it starts broadcasting</small>
</div>
</div>
+ <div class="asc-task-bar" id="asc-task-bar">
+ <form class="asc-task-form" id="asc-task-form" autocomplete="off">
+ <div class="asc-task-icon">▶</div>
+ <input
+ class="asc-task-input"
+ id="asc-task-input"
+ type="text"
+ placeholder="Give your agent a task… (research, browse, monitor anything)"
+ maxlength="1000"
+ spellcheck="false"
+ >
+ <button class="asc-task-send" id="asc-task-send" type="submit" title="Send task">
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path d="M14.5 8L1.5 1.5L5 8L1.5 14.5L14.5 8Z" fill="currentColor"/>
+ </svg>
+ </button>
+ </form>
+ <div class="asc-task-status" id="asc-task-status"></div>
+ </div>
</div>
<div class="asc-right-panel">
<div class="asc-webcam-section">
@@ -286,6 +576,56 @@ async function boot(id) {
client.connect();
+ // ── task input ────────────────────────────────────────────────────────
+ const taskForm = document.getElementById('asc-task-form');
+ const taskInput = document.getElementById('asc-task-input');
+ const taskStatus = document.getElementById('asc-task-status');
+ const taskSend = document.getElementById('asc-task-send');
+
+ taskForm.addEventListener('submit', async (e) => {
+ e.preventDefault();
+ const text = taskInput.value.trim();
+ if (!text) return;
+
+ taskInput.disabled = true;
+ taskSend.disabled = true;
+ taskSend.classList.add('sending');
+ taskStatus.className = 'asc-task-status';
+ taskStatus.textContent = 'Queuing task…';
+
+ try {
+ const res = await fetch('/api/agent-task', {
+ method: 'POST',
+ credentials: 'include',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({ agentId: id, task: text }),
+ });
+ const j = await res.json().catch(() => ({}));
+ if (res.ok) {
+ const prev = taskInput.value;
+ taskInput.value = '';
+ taskStatus.className = 'asc-task-status ok';
+ taskStatus.textContent = 'Task sent — your agent will pick it up shortly';
+ addLogEntry({ ts: Date.now(), activity: `Task queued: ${prev}`, type: 'analysis' });
+ setTimeout(() => { taskStatus.textContent = ''; taskStatus.className = 'asc-task-status'; }, 5000);
+ } else if (res.status === 401) {
+ taskStatus.className = 'asc-task-status err';
+ taskStatus.innerHTML = 'Sign in to send tasks. <a href="/login" style="color:#7aabff">Sign in →</a>';
+ } else {
+ taskStatus.className = 'asc-task-status err';
+ taskStatus.textContent = j.message || j.error_description || 'Could not queue task — try again';
+ }
+ } catch {
+ taskStatus.className = 'asc-task-status err';
+ taskStatus.textContent = 'Network error — check your connection';
+ } finally {
+ taskInput.disabled = false;
+ taskSend.disabled = false;
+ taskSend.classList.remove('sending');
+ taskInput.focus();
+ }
+ });
+
// ── fullscreen ─────────────────────────────────────────────────────────
const screenPanel = document.getElementById('asc-screen-panel');
fsBtn.addEventListener('click', () => {
diff --git a/src/billing-x402.js b/src/billing-x402.js
new file mode 100644
index 000000000..bab86f41a
--- /dev/null
+++ b/src/billing-x402.js
@@ -0,0 +1,254 @@
+// Billing — x402 subscription keys management.
+//
+// Renders the signed-in user's x402 subscription keys (AWS Marketplace and
+// native), with usage, copy-prefix, rotate (one-shot secret reveal), and
+// revoke. Talks to /api/user/x402-subscriptions. Self-contained: no dashboard
+// shell, matches the AWS onboarding aesthetic.
+
+const ENDPOINT = '/api/user/x402-subscriptions';
+
+const el = (id) => document.getElementById(id);
+
+function show(stateId) {
+ for (const s of document.querySelectorAll('.state')) s.classList.toggle('active', s.id === stateId);
+}
+
+let toastTimer;
+function toast(msg, isErr = false) {
+ const t = el('toast');
+ t.textContent = msg;
+ t.classList.toggle('err', isErr);
+ t.classList.add('show');
+ clearTimeout(toastTimer);
+ toastTimer = setTimeout(() => t.classList.remove('show'), 2800);
+}
+
+function esc(s) {
+ return String(s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
+}
+
+function relTime(iso) {
+ if (!iso) return 'never';
+ const then = new Date(iso).getTime();
+ if (!Number.isFinite(then)) return 'never';
+ const diff = Date.now() - then;
+ const min = Math.floor(diff / 60000);
+ if (min < 1) return 'just now';
+ if (min < 60) return `${min}m ago`;
+ const hr = Math.floor(min / 60);
+ if (hr < 24) return `${hr}h ago`;
+ const day = Math.floor(hr / 24);
+ if (day < 30) return `${day}d ago`;
+ return new Date(iso).toLocaleDateString(undefined, { month: 'short', day: 'numeric', year: 'numeric' });
+}
+
+function fmtDate(iso) {
+ if (!iso) return '—';
+ return new Date(iso).toLocaleDateString(undefined, { month: 'short', day: 'numeric', year: 'numeric' });
+}
+
+function statusPill(status) {
+ const labels = { active: 'Active', revoked: 'Revoked', expired: 'Expired' };
+ return `<span class="pill ${status}"><span class="dot"></span>${labels[status] || status}</span>`;
+}
+
+function cardHTML(sub) {
+ const sourceBadge =
+ sub.source === 'aws-marketplace'
+ ? `<span class="badge aws">AWS Marketplace</span>`
+ : `<span class="badge native">Native</span>`;
+ const trialBadge = sub.isFreeTrial ? `<span class="badge trial">Free trial</span>` : '';
+ const isActive = sub.status === 'active';
+ const isAws = sub.source === 'aws-marketplace';
+
+ // Revoke is hidden for AWS keys (cancellation must originate in AWS Marketplace).
+ const revokeBtn =
+ isActive && !isAws
+ ? `<button class="btn danger" data-action="revoke" data-id="${esc(sub.id)}">Revoke</button>`
+ : '';
+ const rotateBtn = isActive
+ ? `<button class="btn" data-action="rotate" data-id="${esc(sub.id)}">Rotate key</button>`
+ : '';
+
+ return `
+ <div class="card" data-card="${esc(sub.id)}">
+ <div class="card-top">
+ <div class="card-name">${esc(sub.name)}</div>
+ <div class="badges">${sourceBadge}${trialBadge}${statusPill(sub.status)}</div>
+ </div>
+ <div class="meta-grid">
+ <div><div class="label">Key</div><div class="value key-prefix">${esc(sub.keyPrefix)}…</div></div>
+ <div><div class="label">Rate limit</div><div class="value">${sub.rateLimitPerMinute}/min</div></div>
+ <div><div class="label">Calls</div><div class="value">${sub.usage.granted.toLocaleString()}${sub.usage.denied ? ` · ${sub.usage.denied.toLocaleString()} denied` : ''}</div></div>
+ <div><div class="label">Last used</div><div class="value">${esc(relTime(sub.usage.lastSeenAt))}</div></div>
+ <div><div class="label">Created</div><div class="value">${esc(fmtDate(sub.createdAt))}</div></div>
+ </div>
+ <div class="card-actions">
+ <button class="btn ghost" data-action="copy-prefix" data-prefix="${esc(sub.keyPrefix)}">Copy prefix</button>
+ ${rotateBtn}
+ ${revokeBtn}
+ </div>
+ <div class="reveal-slot"></div>
+ </div>`;
+}
+
+function renderReveal(card, token) {
+ const slot = card.querySelector('.reveal-slot');
+ slot.innerHTML = `
+ <div class="reveal">
+ <div class="reveal-label">
+ <span>New API key</span>
+ <button type="button" class="copy" data-copy-token>Copy</button>
+ </div>
+ <div class="reveal-value" data-token>${esc(token)}</div>
+ <div class="reveal-note">Shown once. Store it now — it grants every paid call on this subscription and cannot be retrieved again.</div>
+ </div>`;
+ const tokenEl = slot.querySelector('[data-token]');
+ const copyBtn = slot.querySelector('[data-copy-token]');
+ copyBtn.addEventListener('click', async () => {
+ await copy(tokenEl.textContent);
+ copyBtn.textContent = 'Copied';
+ copyBtn.classList.add('copied');
+ setTimeout(() => { copyBtn.textContent = 'Copy'; copyBtn.classList.remove('copied'); }, 1800);
+ });
+}
+
+async function copy(text) {
+ try {
+ await navigator.clipboard.writeText(text);
+ return true;
+ } catch {
+ const ta = document.createElement('textarea');
+ ta.value = text;
+ ta.style.position = 'fixed';
+ ta.style.opacity = '0';
+ document.body.appendChild(ta);
+ ta.select();
+ try { document.execCommand('copy'); } catch { /* noop */ }
+ ta.remove();
+ return true;
+ }
+}
+
+async function load() {
+ show('state-loading');
+ let resp;
+ try {
+ resp = await fetch(ENDPOINT, { credentials: 'include' });
+ } catch {
+ return showError("Couldn't reach the server", 'Check your connection and try again.');
+ }
+ if (resp.status === 401) {
+ location.href = `/login?return=${encodeURIComponent(location.pathname)}`;
+ return;
+ }
+ if (!resp.ok) {
+ return showError("Couldn't load your keys", 'Something went wrong on our end. Please retry in a moment.');
+ }
+ let data;
+ try {
+ data = await resp.json();
+ } catch {
+ return showError("Couldn't load your keys", 'We received an unexpected response. Please retry.');
+ }
+
+ const subs = Array.isArray(data.subscriptions) ? data.subscriptions : [];
+ if (subs.length === 0) {
+ show('state-empty');
+ return;
+ }
+
+ const active = subs.find((s) => s.status === 'active');
+ if (active) el('example-prefix').textContent = `${active.keyPrefix}…`;
+
+ el('cards').innerHTML = subs.map(cardHTML).join('');
+ show('state-list');
+}
+
+function showError(title, body) {
+ el('error-title').textContent = title;
+ el('error-body').textContent = body;
+ show('state-error');
+}
+
+async function rotate(id, btn) {
+ const card = document.querySelector(`[data-card="${CSS.escape(id)}"]`);
+ if (!window.confirm('Rotate this key? The current key stops working immediately and a new one is shown once.')) return;
+ setBusy(card, true);
+ let resp;
+ try {
+ resp = await fetch(ENDPOINT, {
+ method: 'POST',
+ headers: { 'content-type': 'application/json' },
+ credentials: 'include',
+ body: JSON.stringify({ action: 'rotate', id }),
+ });
+ } catch {
+ setBusy(card, false);
+ return toast("Couldn't reach the server", true);
+ }
+ const out = await resp.json().catch(() => ({}));
+ if (!resp.ok) {
+ setBusy(card, false);
+ return toast(out.message || 'Rotation failed. Please try again.', true);
+ }
+ const token = out.subscription?.token;
+ toast('Key rotated.');
+ // Reload to reflect the new subscription row, then reveal the fresh secret
+ // on its card.
+ await load();
+ if (token && out.subscription?.id) {
+ const fresh = document.querySelector(`[data-card="${CSS.escape(out.subscription.id)}"]`);
+ if (fresh) {
+ renderReveal(fresh, token);
+ fresh.scrollIntoView({ behavior: 'smooth', block: 'center' });
+ }
+ }
+}
+
+async function revoke(id, btn) {
+ const card = document.querySelector(`[data-card="${CSS.escape(id)}"]`);
+ if (!window.confirm('Revoke this key permanently? Any integration using it will stop working immediately.')) return;
+ setBusy(card, true);
+ let resp;
+ try {
+ resp = await fetch(ENDPOINT, {
+ method: 'POST',
+ headers: { 'content-type': 'application/json' },
+ credentials: 'include',
+ body: JSON.stringify({ action: 'revoke', id }),
+ });
+ } catch {
+ setBusy(card, false);
+ return toast("Couldn't reach the server", true);
+ }
+ const out = await resp.json().catch(() => ({}));
+ if (!resp.ok) {
+ setBusy(card, false);
+ return toast(out.message || 'Revoke failed. Please try again.', true);
+ }
+ toast('Key revoked.');
+ await load();
+}
+
+function setBusy(card, busy) {
+ if (!card) return;
+ for (const b of card.querySelectorAll('.btn')) b.disabled = busy;
+}
+
+document.addEventListener('click', (e) => {
+ const btn = e.target.closest('[data-action]');
+ if (!btn) return;
+ const action = btn.dataset.action;
+ if (action === 'copy-prefix') {
+ copy(`${btn.dataset.prefix}…`).then(() => toast('Prefix copied. The full secret is only shown when you rotate.'));
+ } else if (action === 'rotate') {
+ rotate(btn.dataset.id, btn);
+ } else if (action === 'revoke') {
+ revoke(btn.dataset.id, btn);
+ }
+});
+
+el('btn-retry')?.addEventListener('click', load);
+
+load();
diff --git a/src/dashboard-next/pages/agents.js b/src/dashboard-next/pages/agents.js
index 61e4077e3..240d85e8a 100644
--- a/src/dashboard-next/pages/agents.js
+++ b/src/dashboard-next/pages/agents.js
@@ -300,6 +300,14 @@ function renderAgents(host, agents, avatars, root) {
});
});
+ host.querySelectorAll('[data-action="screen-caster"]').forEach((btn) => {
+ btn.addEventListener('click', () => {
+ const id = btn.dataset.id;
+ const agent = agents.find((a) => a.id === id);
+ if (agent) openCasterModal(agent);
+ });
+ });
+
loadInlineReviewStats(host, agents);
enrichAgentTradingStatus(host, agents);
}
@@ -504,6 +512,9 @@ function agentCard(a, avatars) {
<button class="dn-btn ghost" data-action="view-reputation" data-id="${esc(a.id)}" style="padding:5px 10px;font-size:12px">Reputation</button>
${onchain ? '' : `<button class="dn-btn ghost" data-action="deploy-onchain" data-id="${esc(a.id)}" style="padding:5px 10px;font-size:12px">Deploy onchain</button>`}
${pumpMint ? '' : `<button class="dn-btn ghost" data-action="deploy-pump" data-id="${esc(a.id)}" style="padding:5px 10px;font-size:12px">Deploy Pump.fun</button>`}
+ <button class="dn-btn ghost" data-action="screen-caster" data-id="${esc(a.id)}" style="padding:5px 10px;font-size:12px" title="Get screen caster credentials">
+ <svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" style="margin-right:4px;vertical-align:-1px"><rect x="1" y="2.5" width="14" height="9" rx="1.5"/><path d="M5.5 13.5h5M8 11.5v2"/></svg>Screen
+ </button>
<button class="dn-btn ghost danger" data-action="delete-agent" data-id="${esc(a.id)}" style="padding:5px 10px;font-size:12px">Delete</button>
</div>
</div>
@@ -1143,6 +1154,183 @@ function openPersonaModal(host, agent, allAgents, avatars) {
.addEventListener('click', () => seedAction('seed-farcaster'));
}
+// ── Screen Caster setup modal ──────────────────────────────────────────────
+
+async function openCasterModal(agent) {
+ const overlay = makeOverlay();
+ const name = esc(agent.name || agent.display_name || 'Agent');
+
+ overlay.innerHTML = `
+ <div role="dialog" aria-modal="true" aria-label="Screen Caster setup" style="
+ width:min(580px,100%);
+ background:linear-gradient(180deg,rgba(22,24,32,0.98),rgba(14,15,22,0.98));
+ border:1px solid var(--nxt-stroke-strong);border-radius:16px;padding:28px;
+ box-shadow:0 24px 80px rgba(0,0,0,0.7);
+ ">
+ <div style="display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:20px">
+ <div>
+ <div style="display:flex;align-items:center;gap:10px;margin-bottom:4px">
+ <svg viewBox="0 0 20 20" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" style="color:var(--nxt-accent,#c4b5fd);flex-shrink:0"><rect x="1" y="3" width="18" height="12" rx="2"/><path d="M7 17h6M10 15v2"/><circle cx="7" cy="9" r="1.2" fill="currentColor" stroke="none"/><path d="M9.2 9h5.8M9.2 11.5h4"/></svg>
+ <span style="font-size:17px;font-weight:600">Screen Caster</span>
+ </div>
+ <p style="font-size:13px;color:var(--nxt-ink-dim);margin:0">
+ Run a Playwright browser that streams live screenshots for <strong style="color:var(--nxt-ink)">${name}</strong>.
+ Generate credentials once, deploy anywhere Docker runs.
+ </p>
+ </div>
+ <button data-action="close" aria-label="Close" style="
+ flex-shrink:0;background:none;border:none;cursor:pointer;
+ color:var(--nxt-ink-fade);padding:4px;border-radius:6px;
+ transition:color 120ms ease;
+ " onmouseenter="this.style.color='var(--nxt-ink)'" onmouseleave="this.style.color='var(--nxt-ink-fade)'">
+ <svg viewBox="0 0 16 16" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"><path d="M4 4l8 8M12 4l-8 8"/></svg>
+ </button>
+ </div>
+
+ <div data-slot="body">
+ <div style="
+ display:flex;align-items:center;justify-content:center;gap:10px;
+ padding:32px;color:var(--nxt-ink-dim);font-size:13px;
+ ">
+ <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" style="animation:dn-spin 1s linear infinite;flex-shrink:0"><path d="M21 12a9 9 0 11-9-9c2.01 0 3.86.67 5.36 1.8"/></svg>
+ Generating credentials…
+ </div>
+ </div>
+ </div>
+ `;
+
+ document.body.appendChild(overlay);
+
+ const close = () => overlay.remove();
+ overlay.querySelector('[data-action="close"]').addEventListener('click', close);
+ overlay.addEventListener('click', (e) => { if (e.target === overlay) close(); });
+ document.addEventListener('keydown', function onKey(e) {
+ if (e.key === 'Escape') { close(); document.removeEventListener('keydown', onKey); }
+ });
+
+ const bodySlot = overlay.querySelector('[data-slot="body"]');
+
+ try {
+ const resp = await post('/api/agent/caster-config', { agentId: agent.id });
+ const { envBlock, dockerCmd, prefix } = resp;
+
+ bodySlot.innerHTML = `
+ <div style="
+ display:flex;align-items:center;gap:8px;padding:10px 14px;
+ border-radius:8px;background:rgba(52,211,153,0.08);
+ border:1px solid rgba(52,211,153,0.2);margin-bottom:18px;
+ ">
+ <svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="#34d399" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" style="flex-shrink:0"><polyline points="2.5 8.5 6 12 13.5 4.5"/></svg>
+ <span style="font-size:12.5px;color:#34d399">API key created</span>
+ <code style="
+ margin-left:auto;font-size:11px;padding:2px 8px;
+ background:rgba(52,211,153,0.1);border-radius:4px;
+ color:#34d399;letter-spacing:0.03em;
+ ">${esc(prefix)}…</code>
+ </div>
+
+ <div style="margin-bottom:16px">
+ <div style="
+ display:flex;align-items:center;justify-content:space-between;
+ margin-bottom:6px;
+ ">
+ <span style="font-size:12px;font-weight:600;color:var(--nxt-ink-fade);text-transform:uppercase;letter-spacing:0.06em">.env</span>
+ <button data-copy="env" style="
+ background:none;border:1px solid var(--nxt-stroke);border-radius:6px;
+ color:var(--nxt-ink-dim);font:inherit;font-size:11.5px;cursor:pointer;
+ padding:3px 10px;transition:color 120ms,border-color 120ms;
+ ">Copy</button>
+ </div>
+ <pre data-block="env" style="
+ margin:0;padding:14px 16px;border-radius:10px;overflow-x:auto;
+ background:rgba(0,0,0,0.35);border:1px solid var(--nxt-stroke);
+ font-size:12px;line-height:1.7;color:#e2e8f0;
+ font-family:'JetBrains Mono',ui-monospace,SFMono-Regular,Menlo,monospace;
+ white-space:pre;
+ ">${esc(envBlock)}</pre>
+ </div>
+
+ <div style="margin-bottom:20px">
+ <div style="
+ display:flex;align-items:center;justify-content:space-between;
+ margin-bottom:6px;
+ ">
+ <span style="font-size:12px;font-weight:600;color:var(--nxt-ink-fade);text-transform:uppercase;letter-spacing:0.06em">Docker run</span>
+ <button data-copy="docker" style="
+ background:none;border:1px solid var(--nxt-stroke);border-radius:6px;
+ color:var(--nxt-ink-dim);font:inherit;font-size:11.5px;cursor:pointer;
+ padding:3px 10px;transition:color 120ms,border-color 120ms;
+ ">Copy</button>
+ </div>
+ <pre data-block="docker" style="
+ margin:0;padding:14px 16px;border-radius:10px;overflow-x:auto;
+ background:rgba(0,0,0,0.35);border:1px solid var(--nxt-stroke);
+ font-size:12px;line-height:1.7;color:#e2e8f0;
+ font-family:'JetBrains Mono',ui-monospace,SFMono-Regular,Menlo,monospace;
+ white-space:pre;
+ ">${esc(dockerCmd)}</pre>
+ </div>
+
+ <div style="
+ display:flex;flex-direction:column;gap:6px;padding:12px 14px;
+ border-radius:8px;background:rgba(255,255,255,0.02);
+ border:1px solid var(--nxt-stroke);font-size:12.5px;color:var(--nxt-ink-dim);
+ ">
+ <div style="font-weight:600;color:var(--nxt-ink-fade);margin-bottom:2px;font-size:11.5px;text-transform:uppercase;letter-spacing:0.06em">Deploy anywhere Docker runs</div>
+ <div style="display:flex;align-items:baseline;gap:6px"><span style="color:var(--nxt-ink);font-weight:500;min-width:80px">Railway</span><span><a href="https://railway.app" target="_blank" rel="noopener" style="color:var(--nxt-accent,#c4b5fd)">railway.app</a> → New Project → Deploy Docker Image</span></div>
+ <div style="display:flex;align-items:baseline;gap:6px"><span style="color:var(--nxt-ink);font-weight:500;min-width:80px">Fly.io</span><span><code style="font-size:11px">fly launch --image three-ws/agent-screen-caster</code></span></div>
+ <div style="display:flex;align-items:baseline;gap:6px"><span style="color:var(--nxt-ink);font-weight:500;min-width:80px">Cloud Run</span><span>Container → set env vars → deploy</span></div>
+ <div style="display:flex;align-items:baseline;gap:6px"><span style="color:var(--nxt-ink);font-weight:500;min-width:80px">Local</span><span><code style="font-size:11px">npm install && npm start</code> inside <code style="font-size:11px">services/agent-screen-caster/</code></span></div>
+ </div>
+
+ <div style="display:flex;justify-content:space-between;align-items:center;margin-top:18px;gap:12px;flex-wrap:wrap">
+ <a href="/dashboard-next/watch?agentId=${encodeURIComponent(agent.id)}" target="_blank" rel="noopener" style="
+ font-size:12.5px;color:var(--nxt-accent,#c4b5fd);text-decoration:none;
+ display:inline-flex;align-items:center;gap:5px;
+ ">
+ <svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M8 3C4.5 3 1.5 6 1.5 8s3 5 6.5 5 6.5-3 6.5-5-3-5-6.5-5z"/><circle cx="8" cy="8" r="2"/></svg>
+ Preview watch panel ↗
+ </a>
+ <button data-action="close-done" class="dn-btn primary" style="font-size:13px;padding:7px 18px">Done</button>
+ </div>
+ `;
+
+ bodySlot.querySelector('[data-action="close-done"]').addEventListener('click', close);
+
+ bodySlot.querySelectorAll('[data-copy]').forEach((btn) => {
+ const key = btn.dataset.copy;
+ const pre = bodySlot.querySelector(`[data-block="${key}"]`);
+ btn.addEventListener('click', async () => {
+ try {
+ await navigator.clipboard.writeText(pre.textContent);
+ btn.textContent = 'Copied!';
+ btn.style.color = '#34d399';
+ btn.style.borderColor = 'rgba(52,211,153,0.4)';
+ setTimeout(() => {
+ btn.textContent = 'Copy';
+ btn.style.color = '';
+ btn.style.borderColor = '';
+ }, 1800);
+ } catch {
+ toast('Copy failed — select and copy manually');
+ }
+ });
+ });
+
+ } catch (err) {
+ bodySlot.innerHTML = `
+ <div style="
+ padding:16px;border-radius:8px;background:rgba(248,113,113,0.08);
+ border:1px solid rgba(248,113,113,0.2);color:#f87171;font-size:13px;
+ ">${esc(err?.body?.error || err?.message || 'Failed to generate credentials. Try again.')}</div>
+ <div style="display:flex;justify-content:flex-end;margin-top:14px">
+ <button data-action="close" class="dn-btn ghost" style="font-size:13px">Close</button>
+ </div>
+ `;
+ bodySlot.querySelector('[data-action="close"]').addEventListener('click', close);
+ }
+}
+
// ── Helpers ────────────────────────────────────────────────────────────────
function makeOverlay() {
@@ -1236,6 +1424,7 @@ function injectStyles() {
white-space: nowrap;
font-variant-numeric: tabular-nums;
}
+ @keyframes dn-spin { to { transform: rotate(360deg); } }
@media (max-width: 600px) {
.dn-agents-filter-bar { flex-direction: column; align-items: stretch; }
.dn-agents-sort-wrap { justify-content: space-between; }
diff --git a/src/marketplace.js b/src/marketplace.js
index a13830a78..79f7bf43b 100644
--- a/src/marketplace.js
+++ b/src/marketplace.js
@@ -7923,6 +7923,7 @@ function init() {
loadList(true);
loadTheme();
loadOracleStats();
+ loadTopPerformers();
initPlugins();
fetchUserPurchases();
loadCurrentUser();
@@ -8561,6 +8562,69 @@ async function loadOracleStats() {
}
}
+const TOP_RANK_COLORS = ['#f59e0b', '#94a3b8', '#cd7c4f'];
+const TOP_RANK_LABELS = ['#1', '#2', '#3'];
+
+async function loadTopPerformers() {
+ const section = $('mkt-top-section');
+ const podium = $('mkt-top-podium');
+ if (!section || !podium) return;
+
+ // Show skeleton cards immediately so there's no layout jump when data arrives.
+ podium.innerHTML = [0, 1, 2].map((i) => `
+ <div class="mkt-top-card mkt-skel" style="--rank-color:${TOP_RANK_COLORS[i]}">
+ <span class="mkt-top-rank">${TOP_RANK_LABELS[i]}</span>
+ <div class="mkt-top-av-wrap"></div>
+ <div class="mkt-top-name" style="width:70%;height:12px">&nbsp;</div>
+ <div class="mkt-top-wr" style="width:60%;height:28px;margin-top:8px">&nbsp;</div>
+ <div class="mkt-top-wr-lbl" style="width:50%;height:10px">&nbsp;</div>
+ <div class="mkt-top-meta" style="width:80%;height:10px">&nbsp;</div>
+ </div>`).join('');
+ section.hidden = false;
+
+ try {
+ const r = await fetch('/api/oracle/leaderboard?limit=3&min_actions=3', {
+ headers: { accept: 'application/json' },
+ });
+ if (!r.ok) { section.hidden = true; return; }
+ const data = await r.json();
+ const agents = data.agents || [];
+ if (agents.length === 0) { section.hidden = true; return; }
+
+ podium.innerHTML = agents.map((a, i) => {
+ const color = TOP_RANK_COLORS[i] || '#6b7280';
+ const label = TOP_RANK_LABELS[i] || `#${i + 1}`;
+ const winRate = a.win_rate != null ? `${a.win_rate}%` : '—';
+ const pnl = a.realized_pnl_sol != null
+ ? `${a.realized_pnl_sol >= 0 ? '+' : ''}${Number(a.realized_pnl_sol).toFixed(3)} SOL`
+ : null;
+ const pnlClass = a.realized_pnl_sol != null
+ ? (a.realized_pnl_sol >= 0 ? 'pos' : 'neg')
+ : '';
+ const avatarHtml = a.image_url
+ ? `<img src="${escapeHtml(a.image_url)}" alt="" class="mkt-top-avatar" loading="lazy" onerror="this.style.display='none'">`
+ : `<span class="mkt-top-avatar-fallback">${escapeHtml((a.name || '?')[0].toUpperCase())}</span>`;
+
+ return `<a class="mkt-top-card" href="/agents/${encodeURIComponent(a.agent_id)}"
+ style="--rank-color:${color}"
+ title="${escapeHtml(a.name || a.agent_id)}"
+ aria-label="${escapeHtml(a.name || 'Agent')} — rank ${i + 1}, ${winRate} oracle win rate">
+ <span class="mkt-top-rank">${label}</span>
+ <div class="mkt-top-av-wrap">${avatarHtml}</div>
+ <div class="mkt-top-name">${escapeHtml(a.name || 'Agent')}</div>
+ <div class="mkt-top-wr">${escapeHtml(winRate)}</div>
+ <div class="mkt-top-wr-lbl">Win rate</div>
+ <div class="mkt-top-meta">
+ <span>${a.wins}W / ${a.losses}L${a.open > 0 ? ` / ${a.open} open` : ''}</span>
+ ${pnl ? `<span class="mkt-top-pnl ${pnlClass}">${escapeHtml(pnl)}</span>` : ''}
+ </div>
+ </a>`;
+ }).join('');
+ } catch {
+ section.hidden = true;
+ }
+}
+
function initPlugins() {
// Add by URL button
const addBtn = $('plugin-add-url');
diff --git a/workers/agent-screen-worker/config.js b/workers/agent-screen-worker/config.js
index 181183e90..1e4fb3646 100644
--- a/workers/agent-screen-worker/config.js
+++ b/workers/agent-screen-worker/config.js
@@ -15,6 +15,7 @@ export function loadConfig() {
AGENT_ID: process.env.AGENT_ID,
AGENT_JWT: process.env.AGENT_JWT,
PUSH_URL: process.env.PUSH_URL || 'https://three.ws/api/agent-screen-push',
+ TASK_URL: process.env.TASK_URL || 'https://three.ws/api/agent-task',
BROWSERBASE_API_KEY,
BROWSERBASE_PROJECT_ID,
CYCLE_MS: Number(process.env.CYCLE_MS || 30_000),
diff --git a/workers/agent-screen-worker/task-runner.js b/workers/agent-screen-worker/task-runner.js
index ff7ccbdf4..739bfba69 100644
--- a/workers/agent-screen-worker/task-runner.js
+++ b/workers/agent-screen-worker/task-runner.js
@@ -1,15 +1,23 @@
/**
- * Default autonomous task: scan pump.fun for trending tokens, narrate findings.
+ * Task runner for agent-screen-worker.
*
- * Swap this out (or extend it) for the agent's actual mission. The contract
- * is simple: receive { stagehand, page, cfg, push } and run a loop forever.
- * Call push() for every meaningful action so the screen stream stays live.
+ * Two modes:
+ * 1. Queued tasks — user sends a task from /agent-screen?agentId=X via the
+ * platform UI. The worker polls GET /api/agent-task, receives the task,
+ * and executes it with Stagehand.
*
- * Stagehand v3 API: page.act() and page.extract() (not stagehand.act/extract).
+ * 2. Autonomous loop — when no queued task is waiting, the worker falls back
+ * to the default mission (scan pump.fun for trending tokens and narrate).
+ *
+ * Callers: index.js passes { page, context, cfg, push } and runs this forever.
+ * push() signature: ({ agentId, page, activity, type }) → Promise<void>
*/
+
import { z } from 'zod';
+import fetch from 'node-fetch';
const PUMP_FUN_URL = 'https://pump.fun';
+const TASK_POLL_MS = 3_000; // how often to check for a user-queued task
const TokenListSchema = z.object({
tokens: z.array(
@@ -21,92 +29,238 @@ const TokenListSchema = z.object({
),
});
-const TokenDetailSchema = z.object({
- price: z.string().optional(),
- holders: z.string().optional(),
- volume: z.string().optional(),
-});
+// ── main export ───────────────────────────────────────────────────────────────
export async function runTask({ page, cfg, push }) {
const { agentId, CYCLE_MS } = cfg;
while (true) {
+ // ── Check platform for a queued task first ────────────────────────────
+ const queued = await pollForTask(cfg);
+ if (queued) {
+ await runQueuedTask({ page, cfg, push, task: queued });
+ continue; // check for more queued tasks immediately after
+ }
+
+ // ── No queued task — run autonomous cycle ─────────────────────────────
+ await runAutonomousCycle({ page, cfg, push });
+ await sleep(CYCLE_MS);
+ }
+}
+
+// ── Platform task execution ────────────────────────────────────────────────────
+
+async function pollForTask(cfg) {
+ try {
+ const url = `${cfg.TASK_URL}?agentId=${encodeURIComponent(cfg.AGENT_ID)}`;
+ const res = await fetch(url, {
+ headers: { authorization: `Bearer ${cfg.AGENT_JWT}` },
+ signal: AbortSignal.timeout(8_000),
+ });
+ if (!res.ok) return null;
+ const j = await res.json();
+ return j.task || null; // { text, type, ts }
+ } catch {
+ return null; // silent — never block the main loop on a network error
+ }
+}
+
+async function runQueuedTask({ page, cfg, push, task }) {
+ const { agentId } = cfg;
+ const { text, type: taskType } = task;
+
+ console.log(`[task-runner] executing queued task (${taskType}): ${text}`);
+
+ await push({ agentId, page: null, activity: `Starting task: ${text}`, type: 'analysis' });
+
+ // Navigate to a sensible starting point based on task type
+ const startUrl = pickStartUrl(text, taskType);
+ try {
+ await push({ agentId, page, activity: `Navigating to ${new URL(startUrl).hostname}…`, type: 'activity' });
+ await page.goto(startUrl, { waitUntil: 'domcontentloaded', timeout: 30_000 });
+ await push({ agentId, page, activity: `Page loaded — beginning task`, type: 'screenshot' });
+ } catch (err) {
+ await push({ agentId, page: null, activity: `Navigation error: ${err.message}`, type: 'activity' });
+ }
+
+ // Execute the task using Stagehand's act() and extract() — natural-language browser control
+ const steps = breakTaskIntoSteps(text, taskType);
+ for (const step of steps) {
try {
- // ── Navigate ────────────────────────────────────────────────────────
- await push({ agentId, page, activity: 'Navigating to pump.fun…', type: 'activity' });
- await page.goto(PUMP_FUN_URL, { waitUntil: 'domcontentloaded', timeout: 30_000 });
- await push({ agentId, page, activity: 'Scanning pump.fun for trending tokens', type: 'screenshot' });
+ await push({ agentId, page: null, activity: step.narration, type: 'analysis' });
- // ── Extract trending tokens ─────────────────────────────────────────
- let trending = { tokens: [] };
- try {
- trending = await page.extract({
- instruction: 'Extract the top 5 trending token names, symbols, and market caps visible on this page',
- schema: TokenListSchema,
+ if (step.action === 'act') {
+ await page.act({ action: step.instruction });
+ await push({ agentId, page, activity: step.narration, type: 'screenshot' });
+ } else if (step.action === 'extract') {
+ const ResultSchema = z.object({ result: z.string() });
+ const extracted = await page.extract({
+ instruction: step.instruction,
+ schema: ResultSchema,
});
- } catch (err) {
- console.warn('[task] extract failed:', err.message);
+ if (extracted?.result) {
+ await push({
+ agentId,
+ page,
+ activity: `Found: ${extracted.result.slice(0, 240)}`,
+ type: 'analysis',
+ });
+ }
+ } else if (step.action === 'observe') {
+ await push({ agentId, page, activity: step.narration, type: 'screenshot' });
}
+ } catch (err) {
+ await push({ agentId, page: null, activity: `Step failed: ${err.message}`, type: 'activity' });
+ }
+
+ await sleep(TASK_POLL_MS);
+ }
- const count = trending.tokens?.length ?? 0;
+ await push({ agentId, page, activity: `Task complete: ${text.slice(0, 120)}`, type: 'analysis' });
+}
+
+function pickStartUrl(taskText, taskType) {
+ const t = taskText.toLowerCase();
+ if (t.includes('flight') || t.includes('travel') || t.includes('fly')) {
+ return 'https://www.google.com/travel/flights';
+ }
+ if (t.includes('reddit')) return 'https://www.reddit.com';
+ if (t.includes('youtube')) return 'https://www.youtube.com';
+ if (t.includes('amazon') || t.includes('buy') || t.includes('shop') || t.includes('price')) {
+ return 'https://www.amazon.com';
+ }
+ if (t.includes('news') || t.includes('latest') || t.includes('today')) {
+ return 'https://news.ycombinator.com';
+ }
+ if (t.includes('stock') || t.includes('market') || t.includes('nasdaq') || t.includes('nyse')) {
+ return 'https://finance.yahoo.com';
+ }
+ if (t.includes('weather')) return 'https://weather.com';
+ if (t.includes('recipe') || t.includes('cook') || t.includes('food')) {
+ return 'https://www.allrecipes.com';
+ }
+ if (taskType === 'trade') return 'https://pump.fun';
+ return `https://www.google.com/search?q=${encodeURIComponent(taskText)}`;
+}
+
+function breakTaskIntoSteps(taskText, taskType) {
+ if (taskType === 'research' || taskType === 'general') {
+ return [
+ { action: 'observe', narration: `Scanning the page for relevant information`, instruction: taskText },
+ {
+ action: 'extract',
+ narration: 'Extracting key findings',
+ instruction: `Extract the most relevant information for this task: "${taskText}". Summarize in 2–3 sentences.`,
+ },
+ ];
+ }
+
+ if (taskType === 'trade') {
+ return [
+ { action: 'observe', narration: 'Scanning trending tokens', instruction: 'Look at the trending tokens on this page' },
+ {
+ action: 'extract',
+ narration: 'Reading token data',
+ instruction: 'Extract the top trending token names, symbols, and market caps visible',
+ },
+ ];
+ }
+
+ return [
+ { action: 'observe', narration: `Looking for: ${taskText}`, instruction: taskText },
+ {
+ action: 'act',
+ narration: 'Interacting with the page',
+ instruction: taskText,
+ },
+ {
+ action: 'extract',
+ narration: 'Collecting results',
+ instruction: `Based on the task "${taskText}", summarize what was found on this page.`,
+ },
+ ];
+}
+
+// ── Autonomous cycle (default: pump.fun scan) ─────────────────────────────────
+
+async function runAutonomousCycle({ page, cfg, push }) {
+ const { agentId } = cfg;
+
+ try {
+ await push({ agentId, page, activity: 'Navigating to pump.fun…', type: 'activity' });
+ await page.goto(PUMP_FUN_URL, { waitUntil: 'domcontentloaded', timeout: 30_000 });
+ await push({ agentId, page, activity: 'Scanning pump.fun for trending tokens', type: 'screenshot' });
+
+ let trending = { tokens: [] };
+ try {
+ trending = await page.extract({
+ instruction: 'Extract the top 5 trending token names, symbols, and market caps visible on this page',
+ schema: TokenListSchema,
+ });
+ } catch (err) {
+ console.warn('[task] extract failed:', err.message);
+ }
+
+ const count = trending.tokens?.length ?? 0;
+ await push({
+ agentId,
+ page,
+ activity:
+ count > 0
+ ? `Found ${count} trending token${count !== 1 ? 's' : ''}: ${trending.tokens
+ .slice(0, 3)
+ .map((t) => (t.symbol ? `$${t.symbol}` : t.name))
+ .join(', ')}`
+ : 'No trending tokens extracted — page may still be loading',
+ type: 'analysis',
+ });
+
+ if (trending.tokens.length > 0) {
+ const pick = trending.tokens[0];
+ const label = pick.symbol ? `$${pick.symbol}` : pick.name;
await push({
agentId,
page,
- activity:
- count > 0
- ? `Found ${count} trending token${count !== 1 ? 's' : ''}: ${trending.tokens
- .slice(0, 3)
- .map((t) => (t.symbol ? `$${t.symbol}` : t.name))
- .join(', ')}`
- : 'No trending tokens extracted — page may still be loading',
+ activity: `Evaluating ${label} — market cap ${pick.marketCap || 'unknown'}`,
type: 'analysis',
});
- // ── Evaluate top pick ───────────────────────────────────────────────
- if (trending.tokens.length > 0) {
- const pick = trending.tokens[0];
- const label = pick.symbol ? `$${pick.symbol}` : pick.name;
- await push({
- agentId,
- page,
- activity: `Evaluating ${label} — market cap ${pick.marketCap || 'unknown'}`,
- type: 'analysis',
- });
-
- try {
- await page.act({ action: `Click on the token named "${pick.name}"` });
- await push({ agentId, page, activity: `Opened ${label} detail page`, type: 'screenshot' });
+ try {
+ await page.act({ action: `Click on the token named "${pick.name}"` });
+ await push({ agentId, page, activity: `Opened ${label} detail page`, type: 'screenshot' });
- const detail = await page.extract({
- instruction: 'Extract price, holder count, and recent transaction volume if visible',
- schema: TokenDetailSchema,
- });
+ const DetailSchema = z.object({
+ price: z.string().optional(),
+ holders: z.string().optional(),
+ volume: z.string().optional(),
+ });
+ const detail = await page.extract({
+ instruction: 'Extract price, holder count, and recent transaction volume if visible',
+ schema: DetailSchema,
+ });
- const parts = [];
- if (detail.price) parts.push(`price ${detail.price}`);
- if (detail.holders) parts.push(`${detail.holders} holders`);
- if (detail.volume) parts.push(`vol ${detail.volume}`);
- if (parts.length) {
- await push({ agentId, page, activity: `${label}: ${parts.join(' · ')}`, type: 'trade' });
- }
- } catch {
- await push({ agentId, page, activity: `Could not open ${label} detail page`, type: 'activity' });
+ const parts = [];
+ if (detail.price) parts.push(`price ${detail.price}`);
+ if (detail.holders) parts.push(`${detail.holders} holders`);
+ if (detail.volume) parts.push(`vol ${detail.volume}`);
+ if (parts.length) {
+ await push({ agentId, page, activity: `${label}: ${parts.join(' · ')}`, type: 'trade' });
}
+ } catch {
+ await push({ agentId, page, activity: `Could not open token detail page`, type: 'activity' });
}
-
- // ── Sleep ───────────────────────────────────────────────────────────
- await push({
- agentId,
- page,
- activity: `Cycle complete — next scan in ${CYCLE_MS / 1000}s`,
- type: 'activity',
- });
- await sleep(CYCLE_MS);
- } catch (err) {
- console.error('[task] cycle error:', err);
- await push({ agentId, page: null, activity: `Error: ${err.message}`, type: 'activity' });
- await sleep(5_000);
}
+
+ await push({
+ agentId,
+ page,
+ activity: `Cycle complete — checking for new tasks in ${TASK_POLL_MS / 1000}s`,
+ type: 'activity',
+ });
+ } catch (err) {
+ console.error('[task] autonomous cycle error:', err);
+ await push({ agentId, page: null, activity: `Error: ${err.message}`, type: 'activity' });
+ await sleep(5_000);
}
}