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.

fix: marketplace guards, wallet detection, docs refresh, agent endpoint-shopper

nirholas23cb0cd7edeb
diff --git a/agents/endpoint-shopper/src/orchestrator.js b/agents/endpoint-shopper/src/orchestrator.js
index 5fe84621e..404f82d6e 100644
--- a/agents/endpoint-shopper/src/orchestrator.js
+++ b/agents/endpoint-shopper/src/orchestrator.js
@@ -7,6 +7,7 @@
import { discoverEndpoints } from './discover.js';
import { planSteps } from './planner.js';
+import { llmComplete } from '../../../api/_lib/llm.js';
const BASE = process.env.PUBLIC_APP_ORIGIN || process.env.APP_ORIGIN || 'https://three.ws';
@@ -174,24 +175,13 @@ async function synthesize({ task, results, catalog, plan }) {
`2-4 sentences maximum.`;
try {
- const r = await fetch('https://api.anthropic.com/v1/messages', {
- method: 'POST',
- headers: {
- 'content-type': 'application/json',
- 'x-api-key': process.env.ANTHROPIC_API_KEY,
- 'anthropic-version': '2023-06-01',
- },
- body: JSON.stringify({
- model: 'claude-haiku-4-5-20251001',
- max_tokens: 256,
- messages: [{ role: 'user', content: prompt }],
- }),
- signal: AbortSignal.timeout(15_000),
+ const { text } = await llmComplete({
+ user: prompt,
+ maxTokens: 256,
+ anthropicKey: process.env.ANTHROPIC_API_KEY,
+ timeoutMs: 15_000,
});
-
- if (!r.ok) return 'Unable to synthesize answer — LLM API returned an error.';
- const d = await r.json();
- return d.content?.[0]?.text || 'Unable to synthesize answer.';
+ return text || 'Unable to synthesize answer.';
} catch {
return 'Unable to synthesize answer — request timed out or failed.';
}
diff --git a/agents/endpoint-shopper/src/planner.js b/agents/endpoint-shopper/src/planner.js
index b566d6ea6..f5d798630 100644
--- a/agents/endpoint-shopper/src/planner.js
+++ b/agents/endpoint-shopper/src/planner.js
@@ -1,8 +1,11 @@
// LLM-based task decomposition for the Endpoint Shopper agent.
//
// Given a task string and a Bazaar catalog summary, generates a structured
-// step plan that the orchestrator can execute. Uses claude-haiku for fast,
-// cheap planning — the heavy work is in the endpoint calls themselves.
+// step plan that the orchestrator can execute. Planning is fast/cheap work, so
+// it runs on the platform's funded free providers (Groq/OpenRouter) by default,
+// using Anthropic only when the operator supplies their own key.
+
+import { llmComplete } from '../../../api/_lib/llm.js';
const SYSTEM_PROMPT =
'You are a task planner for an AI agent. Given a task and a catalog of available paid API endpoints, ' +
@@ -39,32 +42,14 @@ export async function planSteps({ task, catalog, maxSteps = 5 }) {
`Create a plan of at most ${maxSteps} steps to complete the task. ` +
`Respond with a JSON array only — no markdown, no explanation.`;
- const response = await fetch('https://api.anthropic.com/v1/messages', {
- method: 'POST',
- headers: {
- 'content-type': 'application/json',
- 'x-api-key': process.env.ANTHROPIC_API_KEY,
- 'anthropic-version': '2023-06-01',
- },
- body: JSON.stringify({
- model: 'claude-haiku-4-5-20251001',
- max_tokens: 512,
- system: SYSTEM_PROMPT,
- messages: [{ role: 'user', content: prompt }],
- }),
- signal: AbortSignal.timeout(15_000),
+ const { text } = await llmComplete({
+ system: SYSTEM_PROMPT,
+ user: prompt,
+ maxTokens: 512,
+ anthropicKey: process.env.ANTHROPIC_API_KEY,
+ timeoutMs: 15_000,
});
-
- if (!response.ok) {
- const text = await response.text().catch(() => '');
- throw Object.assign(new Error(`Anthropic API error ${response.status}: ${text}`), {
- status: 502,
- code: 'planner_api_error',
- });
- }
-
- const data = await response.json();
- const raw = data.content?.[0]?.text || '[]';
+ const raw = text || '[]';
// Strip possible markdown code fence wrapping
const cleaned = raw.replace(/^```(?:json)?\n?/i, '').replace(/\n?```$/i, '').trim();
diff --git a/public/docs/tutorials/embed-on-website.md b/public/docs/tutorials/embed-on-website.md
index dde17265f..8f66c35b0 100644
--- a/public/docs/tutorials/embed-on-website.md
+++ b/public/docs/tutorials/embed-on-website.md
@@ -1,6 +1,6 @@
-# Embed a three.ws on Your Website
+# Embed a three.ws agent on Your Website
-This tutorial walks you through every path for adding a three.ws to your site — from a no-code copy-paste to a full React integration. Pick the path that matches how you build.
+This tutorial walks you through every path for adding a three.ws agent to your site — from a no-code copy-paste to a full React integration. Pick the path that matches how you build.
**What you'll learn:**
- Get an embed snippet from the Studio (no coding required)
@@ -13,7 +13,7 @@ This tutorial walks you through every path for adding a three.ws to your site
## Before you start
-You need an agent ID. Go to [three.wsstudio](https://three.ws/studio), select or create an agent, and note its ID — it looks like `a_abc123` or is a number paired with a chain ID like `42` on Base.
+You need an agent ID. Go to [three.ws/studio](https://three.ws/studio), select or create an agent, and note its ID — it looks like `a_abc123` or is a number paired with a chain ID like `42` on Base.
---
@@ -21,7 +21,7 @@ You need an agent ID. Go to [three.wsstudio](https://three.ws/studio), select or
If you don't want to write code, the Studio generates the snippet for you.
-1. Go to [three.wsstudio](https://three.ws/studio)
+1. Go to [three.ws/studio](https://three.ws/studio)
2. Select an agent (or create one — the Talking Agent widget is the most popular starting point)
3. Click **Get Embed Code** in the top-right corner
4. Choose your widget type and placement
@@ -51,7 +51,7 @@ The Studio offers two snippet formats. Here's what each one looks like and when
></script>
<!-- Where you want the agent -->
-<agent-three.ws-id="42" chain-id="8453" mode="floating"></agent-3d>
+<agent-3d agent-id="42" chain-id="8453" mode="floating"></agent-3d>
```
The iframe is the safer default for platforms where you can't control the `<head>` (Notion, Substack, Medium). The web component is the right choice anywhere you control the full page — it gives you CSS theming, JS events, and better performance.
@@ -117,7 +117,7 @@ For an inline embed with explicit dimensions:
**Lazy loading is on by default.** The agent won't boot until it scrolls into the viewport (powered by `IntersectionObserver`). Add `eager` to load immediately regardless:
```html
-<agent-three.ws-id="42" chain-id="8453" eager></agent-3d>
+<agent-3d agent-id="42" chain-id="8453" eager></agent-3d>
```
---
@@ -127,7 +127,7 @@ For an inline embed with explicit dimensions:
### Install
```bash
-npm install @3dagent/sdk
+npm install @three-ws/sdk
```
### Create a wrapper component
@@ -137,7 +137,7 @@ npm install @3dagent/sdk
'use client'; // Required for Next.js App Router
import { useEffect, useRef } from 'react';
-import '@3dagent/sdk'; // registers <agent-3d> as a custom element
+import '@three-ws/sdk'; // registers <agent-3d> as a custom element
export default function Agent3D({ agentId, chainId = '8453', mode = 'floating' }) {
const ref = useRef();
@@ -185,7 +185,7 @@ export default function Page() {
return (
<main>
<h1>Welcome</h1>
- <Agentthree.wsId="42" mode="floating" />
+ <Agent3D agentId="42" mode="floating" />
</main>
);
}
@@ -314,7 +314,7 @@ add_action('wp_head', 'add_3dagent_script');
Then add a **Custom HTML** block in the Gutenberg editor wherever you want the agent:
```html
-<agent-three.ws-id="42" chain-id="8453"></agent-3d>
+<agent-3d agent-id="42" chain-id="8453"></agent-3d>
```
---
@@ -431,13 +431,13 @@ Set a background color with the `background` attribute:
```html
<!-- Transparent (default) — composites over your page -->
-<agent-three.ws-id="42" background="transparent"></agent-3d>
+<agent-3d agent-id="42" background="transparent"></agent-3d>
<!-- Dark scene background -->
-<agent-three.ws-id="42" background="dark"></agent-3d>
+<agent-3d agent-id="42" background="dark"></agent-3d>
<!-- Light scene background -->
-<agent-three.ws-id="42" background="light"></agent-3d>
+<agent-3d agent-id="42" background="light"></agent-3d>
```
---
@@ -460,7 +460,7 @@ Or if the parent truly needs to stack above the agent, wrap the `<agent-3d>` in
**Agent is too small / too large**
Set explicit `width` and `height` attributes (CSS length values):
```html
-<agent-three.ws-id="42" width="480px" height="640px"></agent-3d>
+<agent-3d agent-id="42" width="480px" height="640px"></agent-3d>
```
**Next.js hydration error**
diff --git a/public/docs/tutorials/first-agent.md b/public/docs/tutorials/first-agent.md
index 8bde412e0..488c5e195 100644
--- a/public/docs/tutorials/first-agent.md
+++ b/public/docs/tutorials/first-agent.md
@@ -1,4 +1,4 @@
-# Build Your First three.ws
+# Build Your First Agent
By the end of this tutorial you will have a live, talking 3D character on a page you can share with anyone. No build tools, no framework, no prior 3D experience required — just a text editor and a browser.
@@ -21,7 +21,7 @@ You need a GLB file — the standard format for 3D models on the web. Here are t
There's a hosted sample avatar ready to use. Just copy the URL below and you're done for this step:
```
-https://cdn.three.wsmodels/sample-avatar.glb
+https://cdn.three.ws/models/sample-avatar.glb
```
Come back and swap this for your own character later. That's what Step 9 is for.
@@ -61,7 +61,7 @@ Create a new folder somewhere on your computer. Inside it, create a file called
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>My three.ws</title>
+ <title>My three.ws Agent</title>
<style>
body {
margin: 0;
@@ -81,10 +81,10 @@ Create a new folder somewhere on your computer. Inside it, create a file called
</style>
</head>
<body>
- <script type="module" src="https://cdn.three.wsagent-3d.js"></script>
+ <script type="module" src="https://three.ws/agent-3d/latest/agent-3d.js"></script>
<agent-3d
- body="https://cdn.three.wsmodels/sample-avatar.glb"
+ body="https://cdn.three.ws/models/sample-avatar.glb"
width="400px"
height="600px"
></agent-3d>
@@ -129,7 +129,7 @@ Update the `<agent-3d>` tag to add the `brain` and `instructions` attributes:
```html
<agent-3d
- body="https://cdn.three.wsmodels/sample-avatar.glb"
+ body="https://cdn.three.ws/models/sample-avatar.glb"
brain="claude-sonnet-4-6"
name="Aria"
instructions="You are Aria, a friendly and enthusiastic AI guide. You love helping people explore the 3D world. Be concise, warm, and occasionally playful. When someone greets you, wave at them. Keep replies to 2–3 sentences unless asked for more."
@@ -182,7 +182,7 @@ Create `agent.json` in the same folder as `index.html`:
"mode": "local"
},
"skills": [
- { "uri": "https://cdn.three.wsskills/wave/" }
+ { "uri": "https://cdn.three.ws/skills/wave/" }
],
"version": "0.1.0"
}
@@ -200,7 +200,7 @@ Then update `index.html` to load from the manifest instead of using inline attri
The manifest approach is cleaner for anything beyond a one-liner: you can version it in git, keep the instructions in one place, and load it by URL from anywhere.
-> **Note:** If you used the sample avatar URL, replace `./your-character.glb` in the manifest with `https://cdn.three.wsmodels/sample-avatar.glb`.
+> **Note:** If you used the sample avatar URL, replace `./your-character.glb` in the manifest with `https://cdn.three.ws/models/sample-avatar.glb`.
---
@@ -415,7 +415,7 @@ Here's the complete `index.html` all in one place:
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>My three.ws</title>
+ <title>My three.ws Agent</title>
<style>
body {
margin: 0;
@@ -429,7 +429,7 @@ Here's the complete `index.html` all in one place:
</style>
</head>
<body>
- <script type="module" src="https://cdn.three.wsagent-3d.js"></script>
+ <script type="module" src="https://three.ws/agent-3d/latest/agent-3d.js"></script>
<agent-3d
manifest="./agent.json"
@@ -490,7 +490,7 @@ Now that you have a working agent, here's what to explore next:
- [Memory system](../memory.md) — the agent can remember things across conversations using local storage or IPFS.
**Make it permanent:**
-- [ERC-8004 registration](../erc8004.md) — register your agent on-chain for a permanent, decentralized identity. Once registered, anyone can load your agent by its on-chain ID: `<agent-three.ws-id="42" chain-id="8453">`.
+- [ERC-8004 registration](../erc8004.md) — register your agent on-chain for a permanent, decentralized identity. Once registered, anyone can load your agent by its on-chain ID: `<agent-3d agent-id="42" chain-id="8453">`.
**Embed it anywhere:**
- [Embedding guide](../embedding.md) — embed Aria as a floating bubble in the corner of any existing website, or as an iframe widget with a single line of code.
diff --git a/public/docs/tutorials/personal-ai-site.md b/public/docs/tutorials/personal-ai-site.md
index 18368fe67..87307b438 100644
--- a/public/docs/tutorials/personal-ai-site.md
+++ b/public/docs/tutorials/personal-ai-site.md
@@ -257,12 +257,12 @@ Here is the full page. Replace the placeholder values in brackets and swap in yo
</div>
<div class="agent-panel">
- <script type="module" src="https://cdn.three.wsagent-3d.js"></script>
+ <script type="module" src="https://three.ws/agent-3d/latest/agent-3d.js"></script>
<agent-3d
id="maya"
body="https://yourname.com/avatars/maya.glb"
agent-id="your-agent-id"
- brain="claude-opus-4-6"
+ brain="claude-opus-4-7"
style="height: calc(100% - 130px); display: block"
></agent-3d>
diff --git a/public/docs/tutorials/register-onchain.md b/public/docs/tutorials/register-onchain.md
index 33462581b..86df7b9bc 100644
--- a/public/docs/tutorials/register-onchain.md
+++ b/public/docs/tutorials/register-onchain.md
@@ -40,7 +40,7 @@ Skip this step if you already have an agent saved to your account.
**Option A — Generate from a photo:**
-1. Go to [three.wscreate](https://three.ws/create)
+1. Go to [three.ws/create](https://three.ws/create)
2. Take a selfie or upload a photo
3. Your avatar generates in about 30 seconds
4. Give it a name and description
@@ -48,13 +48,13 @@ Skip this step if you already have an agent saved to your account.
**Option B — Upload an existing GLB:**
-1. Go to [three.wsapp](https://three.ws/app)
+1. Go to [three.ws/app](https://three.ws/app)
2. Drag your `.glb` file into the viewer
3. Open the **Manifest** tab in the editor panel
4. Fill in the name and description fields
5. Click **Save to Account**
-Either way, you should end up with an agent visible in your dashboard at [three.wsdashboard](https://three.ws/dashboard).
+Either way, you should end up with an agent visible in your dashboard at [three.ws/dashboard](https://three.ws/dashboard).
---
@@ -101,7 +101,7 @@ If you already have ETH on Base, skip ahead to Step 3.
## Step 4: Open your agent for editing
-1. Go to [three.wsdashboard](https://three.ws/dashboard)
+1. Go to [three.ws/dashboard](https://three.ws/dashboard)
2. Find the agent you want to register
3. Click **Edit** — the editor opens with your avatar loaded
diff --git a/src/marketplace.js b/src/marketplace.js
index 6c7b4713e..6dcbd5a0b 100644
--- a/src/marketplace.js
+++ b/src/marketplace.js
@@ -602,7 +602,7 @@ function renderTheme() {
if (titleEl) titleEl.textContent = state.theme.title;
if (blurbEl) blurbEl.textContent = state.theme.blurb || '';
const cta = $('market-theme-cta');
- if (state.theme.tag) {
+ if (cta && state.theme.tag) {
cta.hidden = false;
cta.textContent = `Browse #${state.theme.tag} →`;
cta.onclick = () => {
@@ -611,7 +611,7 @@ function renderTheme() {
loadList(true);
window.scrollTo({ top: 0, behavior: 'smooth' });
};
- } else {
+ } else if (cta) {
cta.hidden = true;
}
strip.hidden = false;
diff --git a/src/wallet-auth.js b/src/wallet-auth.js
index 2dbb233f9..fb40233a6 100644
--- a/src/wallet-auth.js
+++ b/src/wallet-auth.js
@@ -147,7 +147,7 @@ function _wireClickHandler(buttonEl) {
if (!window.ethereum) {
statusEl.style.display = 'inline';
statusEl.textContent =
- 'No wallet detected — install MetaMask or use a wallet-enabled browser.';
+ 'No wallet detected — install a wallet extension (MetaMask, Coinbase Wallet, etc.) and refresh.';
return;
}