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.

chore: api hardening + seeker dapp store staging assets

nirholasf895cedcf469
diff --git a/api/characters.js b/api/characters.js
index 193da1422..297b58132 100644
--- a/api/characters.js
+++ b/api/characters.js
@@ -28,6 +28,10 @@ export default wrap(async (req, res) => {
const cursorDate = cursor ? new Date(cursor) : null;
+ const qLike = q ? '%' + q + '%' : null;
+ const cursorIso = cursorDate ? cursorDate.toISOString() : null;
+ const sortByChats = sort === 'chats';
+
const rows = await sql`
SELECT
i.id,
@@ -53,10 +57,11 @@ export default wrap(async (req, res) => {
AND i.is_published = true
AND i.description IS NOT NULL
AND length(trim(i.name)) > 0
- ${q ? sql`AND (i.name ILIKE ${'%' + q + '%'} OR i.description ILIKE ${'%' + q + '%'})` : sql``}
- ${cursorDate ? sql`AND i.created_at < ${cursorDate}` : sql``}
+ AND (${qLike}::text IS NULL OR (i.name ILIKE ${qLike} OR i.description ILIKE ${qLike}))
+ AND (${cursorIso}::timestamptz IS NULL OR i.created_at < ${cursorIso}::timestamptz)
ORDER BY
- ${sort === 'chats' ? sql`chat_count DESC, i.created_at DESC` : sql`i.created_at DESC`}
+ CASE WHEN ${sortByChats}::boolean THEN chat_count ELSE 0 END DESC,
+ i.created_at DESC
LIMIT ${limit + 1}
`;
diff --git a/api/sentiment.js b/api/sentiment.js
index 69353e410..c20b2544b 100644
--- a/api/sentiment.js
+++ b/api/sentiment.js
@@ -1,31 +1,35 @@
-
-import { HfInference } from '@huggingface/inference';
-
-const hf = new HfInference(process.env.HF_TOKEN);
-
-export default async function handler(req, res) {
- if (req.method !== 'POST') {
- return res.status(405).json({ error: 'Method Not Allowed' });
- }
-
- const { text } = req.body;
-
- if (!text || typeof text !== 'string') {
- return res.status(400).json({ error: 'Invalid input: "text" must be a non-empty string.' });
- }
-
- try {
- const result = await hf.textClassification({
- model: 'distilbert-base-uncased-finetuned-sst-2-english',
- inputs: text,
- });
-
- const positiveResult = result.find(item => item.label === 'POSITIVE');
- const sentiment = positiveResult && positiveResult.score > 0.6 ? 'Positive' : 'Negative';
-
- return res.status(200).json({ sentiment });
- } catch (error) {
- console.error('Error getting sentiment:', error);
- return res.status(500).json({ error: 'Failed to analyze sentiment.' });
- }
-}
+// POST /api/sentiment
+// body: { text: string }
+// → { sentiment: 'Positive' | 'Negative' | 'Neutral' }
+// Backs the analyze-sentiment skill in src/agent-skills-sentiment.js.
+// Deterministic lexicon scorer — same one used by /api/social/sentiment.
+
+import { cors, json, method, readJson, wrap, error } from './_lib/http.js';
+import { limits, clientIp } from './_lib/rate-limit.js';
+import { scoreSentiment } from '../src/social/sentiment.js';
+
+export default wrap(async (req, res) => {
+ if (cors(req, res, { methods: 'POST,OPTIONS', credentials: false })) return;
+ if (!method(req, res, ['POST'])) return;
+
+ const rl = await limits.publicIp(clientIp(req));
+ if (!rl.success) return error(res, 429, 'rate_limited', 'too many requests');
+
+ let body;
+ try {
+ body = await readJson(req);
+ } catch {
+ return error(res, 400, 'validation_error', 'invalid json');
+ }
+
+ const text = typeof body?.text === 'string' ? body.text.trim() : '';
+ if (!text) return error(res, 400, 'validation_error', '"text" must be a non-empty string');
+
+ const result = scoreSentiment([{ text }]);
+ let sentiment;
+ if (result.posPct > 0 && result.posPct >= result.negPct) sentiment = 'Positive';
+ else if (result.negPct > 0) sentiment = 'Negative';
+ else sentiment = 'Neutral';
+
+ return json(res, 200, { sentiment, score: result.score });
+});
diff --git a/solana-mobile/pwa/manifest.json b/solana-mobile/pwa/manifest.json
new file mode 100644
index 000000000..48d26cc1a
--- /dev/null
+++ b/solana-mobile/pwa/manifest.json
@@ -0,0 +1,62 @@
+{
+ "name": "three.ws — On-chain 3D Agents",
+ "short_name": "three.ws",
+ "description": "Mint a 3D agent to your Seed Vault wallet. Capture, customize, and explore — Solana-native, signed by Seeker.",
+ "id": "/",
+ "scope": "/",
+ "start_url": "/?utm_source=seeker_dapp_store",
+ "display": "standalone",
+ "orientation": "any",
+ "theme_color": "#000000",
+ "background_color": "#080814",
+ "lang": "en",
+ "dir": "ltr",
+ "categories": ["entertainment", "social", "graphics", "utilities"],
+ "icons": [
+ { "src": "/pwa-192x192.png", "sizes": "192x192", "type": "image/png" },
+ { "src": "/pwa-512x512.png", "sizes": "512x512", "type": "image/png" },
+ { "src": "/pwa-512x512.png", "sizes": "512x512", "type": "image/png", "purpose": "any maskable" },
+ { "src": "/pwa-icon.svg", "sizes": "any", "type": "image/svg+xml", "purpose": "any" }
+ ],
+ "shortcuts": [
+ {
+ "name": "Create avatar",
+ "short_name": "Create",
+ "description": "Capture a selfie and mint a 3D agent",
+ "url": "/create?utm_source=seeker_shortcut",
+ "icons": [{ "src": "/pwa-192x192.png", "sizes": "192x192", "type": "image/png" }]
+ },
+ {
+ "name": "Discover agents",
+ "short_name": "Discover",
+ "description": "Browse 3D agents minted on Solana",
+ "url": "/discover?utm_source=seeker_shortcut",
+ "icons": [{ "src": "/pwa-192x192.png", "sizes": "192x192", "type": "image/png" }]
+ },
+ {
+ "name": "My agents",
+ "short_name": "Account",
+ "description": "View agents linked to your wallet",
+ "url": "/account?utm_source=seeker_shortcut",
+ "icons": [{ "src": "/pwa-192x192.png", "sizes": "192x192", "type": "image/png" }]
+ }
+ ],
+ "share_target": {
+ "action": "/create",
+ "method": "POST",
+ "enctype": "multipart/form-data",
+ "params": {
+ "title": "title",
+ "text": "text",
+ "url": "url",
+ "files": [
+ { "name": "selfie", "accept": ["image/jpeg", "image/png", "image/webp"] },
+ { "name": "model", "accept": [".glb", ".gltf", "model/gltf-binary", "model/gltf+json"] }
+ ]
+ }
+ },
+ "protocol_handlers": [
+ { "protocol": "web+threews", "url": "/?ref=%s" }
+ ],
+ "prefer_related_applications": false
+}
diff --git a/solana-mobile/pwa/offline.html b/solana-mobile/pwa/offline.html
new file mode 100644
index 000000000..c21523fd8
--- /dev/null
+++ b/solana-mobile/pwa/offline.html
@@ -0,0 +1,51 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
+ <title>three.ws — Offline</title>
+ <link rel="icon" href="/favicon.ico">
+ <style>
+ :root {
+ color-scheme: dark;
+ --bg: #080814;
+ --fg: #f5f5f7;
+ --muted: #8a8aa0;
+ --accent: #9945ff;
+ }
+ html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); }
+ body {
+ font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, system-ui, sans-serif;
+ display: grid;
+ place-items: center;
+ padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
+ }
+ main { max-width: 28rem; padding: 1.5rem; text-align: center; }
+ h1 { font-size: 1.5rem; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
+ p { color: var(--muted); line-height: 1.5; margin: 0 0 1.5rem; }
+ button {
+ appearance: none;
+ border: 0;
+ background: var(--accent);
+ color: white;
+ font: inherit;
+ font-weight: 600;
+ padding: 0.85rem 1.5rem;
+ border-radius: 999px;
+ cursor: pointer;
+ min-height: 44px;
+ }
+ button:active { transform: translateY(1px); }
+ .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ff5577; margin-right: 6px; vertical-align: middle; }
+ small { display: block; margin-top: 1.25rem; color: var(--muted); font-size: 0.8rem; }
+ </style>
+</head>
+<body>
+ <main>
+ <h1><span class="dot" aria-hidden="true"></span>You're offline</h1>
+ <p>three.ws needs a connection to load 3D models and sign on-chain actions. Reconnect and try again — your session and Seed Vault keys are safe.</p>
+ <button type="button" onclick="location.reload()">Retry</button>
+ <small>Cached agents you've already opened remain available from the home screen.</small>
+ </main>
+</body>
+</html>
diff --git a/solana-mobile/twa/twa-manifest.json b/solana-mobile/twa/twa-manifest.json
new file mode 100644
index 000000000..a1e0543c8
--- /dev/null
+++ b/solana-mobile/twa/twa-manifest.json
@@ -0,0 +1,62 @@
+{
+ "packageId": "ws.three.app",
+ "host": "three.ws",
+ "name": "three.ws",
+ "launcherName": "three.ws",
+ "display": "standalone",
+ "orientation": "default",
+ "themeColor": "#000000",
+ "themeColorDark": "#000000",
+ "navigationColor": "#000000",
+ "navigationColorDark": "#000000",
+ "navigationDividerColor": "#080814",
+ "navigationDividerColorDark": "#080814",
+ "backgroundColor": "#080814",
+ "enableNotifications": true,
+ "startUrl": "/?utm_source=seeker_app",
+ "iconUrl": "https://three.ws/pwa-512x512.png",
+ "maskableIconUrl": "https://three.ws/pwa-512x512.png",
+ "monochromeIconUrl": "https://three.ws/pwa-icon.svg",
+ "appVersionName": "1.0.0",
+ "appVersionCode": 1,
+ "shortcuts": [
+ {
+ "name": "Create avatar",
+ "shortName": "Create",
+ "url": "/create?utm_source=seeker_shortcut",
+ "chosenIconUrl": "https://three.ws/pwa-192x192.png"
+ },
+ {
+ "name": "Discover agents",
+ "shortName": "Discover",
+ "url": "/discover?utm_source=seeker_shortcut",
+ "chosenIconUrl": "https://three.ws/pwa-192x192.png"
+ },
+ {
+ "name": "My agents",
+ "shortName": "Account",
+ "url": "/account?utm_source=seeker_shortcut",
+ "chosenIconUrl": "https://three.ws/pwa-192x192.png"
+ }
+ ],
+ "generatorApp": "bubblewrap-cli",
+ "webManifestUrl": "https://three.ws/manifest.webmanifest",
+ "fallbackType": "customtabs",
+ "features": {
+ "locationDelegation": { "enabled": false },
+ "playBilling": { "enabled": false },
+ "appsFlyer": { "enabled": false },
+ "firstRunFlag": { "enabled": false }
+ },
+ "alphaDependencies": { "enabled": false },
+ "enableSiteSettingsShortcut": true,
+ "isChromeOSOnly": false,
+ "isMetaQuest": false,
+ "fullScopeUrl": "https://three.ws/",
+ "minSdkVersion": 23,
+ "orientationFlag": "default",
+ "splashScreenFadeOutDuration": 300,
+ "additionalTrustedOrigins": [],
+ "retainedBundles": [],
+ "appLanguages": ["en"]
+}
diff --git a/solana-mobile/well-known/assetlinks.json.template b/solana-mobile/well-known/assetlinks.json.template
new file mode 100644
index 000000000..795ef932b
--- /dev/null
+++ b/solana-mobile/well-known/assetlinks.json.template
@@ -0,0 +1,15 @@
+[
+ {
+ "relation": [
+ "delegate_permission/common.handle_all_urls",
+ "delegate_permission/common.use_as_origin"
+ ],
+ "target": {
+ "namespace": "android_app",
+ "package_name": "ws.three.app",
+ "sha256_cert_fingerprints": [
+ "{{RELEASE_SHA256}}"
+ ]
+ }
+ }
+]