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: Refactor navigation and add dynamic widget loading

nirholasfa2490c0406b
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 000000000..b91ba564b
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,16 @@
+# EditorConfig is awesome: https://EditorConfig.org
+
+# top-most EditorConfig file
+root = true
+
+# Unix-style newlines with a newline ending every file
+[*]
+end_of_line = lf
+insert_final_newline = true
+
+# Set rules for specific file types
+[*.{js,jsx,ts,tsx,json,css,scss,md}]
+charset = utf-8
+indent_style = space
+indent_size = 2
+trim_trailing_whitespace = true
diff --git a/.eslintrc.cjs b/.eslintrc.cjs
new file mode 100644
index 000000000..2bb511dad
--- /dev/null
+++ b/.eslintrc.cjs
@@ -0,0 +1,28 @@
+module.exports = {
+ env: {
+ browser: true,
+ es2024: true,
+ node: true,
+ },
+ extends: 'eslint:recommended',
+ parserOptions: {
+ ecmaVersion: 'latest',
+ sourceType: 'module',
+ },
+ rules: {
+ 'no-unused-vars': 'warn',
+ 'no-console': 'warn',
+ },
+ plugins: [
+ 'import',
+ 'promise',
+ 'jsdoc',
+ ],
+ settings: {
+ 'import/resolver': {
+ node: {
+ extensions: ['.js', '.mjs'],
+ },
+ },
+ },
+};
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
new file mode 100644
index 000000000..dd84ea782
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE.md
@@ -0,0 +1,38 @@
+---
+name: Bug report
+about: Create a report to help us improve
+title: ''
+labels: ''
+assignees: ''
+
+---
+
+**Describe the bug**
+A clear and concise description of what the bug is.
+
+**To Reproduce**
+Steps to reproduce the behavior:
+1. Go to '...'
+2. Click on '....'
+3. Scroll down to '....'
+4. See error
+
+**Expected behavior**
+A clear and concise description of what you expected to happen.
+
+**Screenshots**
+If applicable, add screenshots to help explain your problem.
+
+**Desktop (please complete the following information):**
+ - OS: [e.g. iOS]
+ - Browser [e.g. chrome, safari]
+ - Version [e.g. 22]
+
+**Smartphone (please complete the following information):**
+ - Device: [e.g. iPhone6]
+ - OS: [e.g. iOS8.1]
+ - Browser [e.g. stock browser, safari]
+ - Version [e.g. 22]
+
+**Additional context**
+Add any other context about the problem here.
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 000000000..bbcbbe7d6
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,20 @@
+---
+name: Feature request
+about: Suggest an idea for this project
+title: ''
+labels: ''
+assignees: ''
+
+---
+
+**Is your feature request related to a problem? Please describe.**
+A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+
+**Describe the solution you'd like**
+A clear and concise description of what you want to happen.
+
+**Describe alternatives you've considered**
+A clear and concise description of any alternative solutions or features you've considered.
+
+**Additional context**
+Add any other context or screenshots about the feature request here.
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 000000000..9f2619ba0
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,17 @@
+name: Run Tests
+
+on: [push, pull_request]
+
+jobs:
+ test:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - name: Use Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: '20.x'
+ - name: Install dependencies
+ run: npm install
+ - name: Run tests
+ run: npm test
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 000000000..8f3edcec2
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,123 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+We as members, contributors, and leaders pledge to make participation in our
+community a harassment-free experience for everyone, regardless of age, body
+size, visible or invisible disability, ethnicity, sex characteristics, gender
+identity and expression, level of experience, education, socio-economic status,
+nationality, personal appearance, race, religion, or sexual identity
+and orientation.
+
+We pledge to act and interact in ways that contribute to an open, welcoming,
+diverse, inclusive, and healthy community.
+
+## Our Standards
+
+Examples of behavior that contributes to a positive environment for our
+community include:
+
+* Demonstrating empathy and kindness toward other people
+* Being respectful of differing opinions, viewpoints, and experiences
+* Giving and gracefully accepting constructive feedback
+* Accepting responsibility and apologizing to those affected by our mistakes,
+ and learning from the experience
+* Focusing on what is best not just for us as individuals, but for the
+ overall community
+
+Examples of unacceptable behavior include:
+
+* The use of sexualized language or imagery, and sexual attention or
+ advances of any kind
+* Trolling, insulting or derogatory comments, and personal or political
+ attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or email
+ address, without their explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Enforcement Responsibilities
+
+Community leaders are responsible for clarifying and enforcing our standards of
+acceptable behavior and will take appropriate and fair corrective action in
+response to any behavior that they deem inappropriate, threatening, offensive,
+or harmful.
+
+Community leaders have the right and responsibility to remove, edit, or reject
+comments, commits, code, wiki edits, issues, and other contributions that are
+not aligned to this Code of Conduct, and will communicate reasons for moderation
+decisions when appropriate.
+
+## Scope
+
+This Code of Conduct applies within all community spaces, and also applies when
+an individual is officially representing the community in public spaces.
+Examples of representing our community include using an official e-mail address,
+posting via an official social media account, or acting as an appointed
+representative at an online or offline event.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported to the community leaders responsible for enforcement at
+[INSERT CONTACT METHOD].
+All complaints will be reviewed and investigated promptly and fairly.
+
+All community leaders are obligated to respect the privacy and security of the
+reporter of any incident.
+
+## Enforcement Guidelines
+
+Community leaders will follow these Community Impact Guidelines in determining
+the consequences for any action they deem in violation of this Code of Conduct:
+
+### 1. Correction
+
+**Community Impact**: Use of inappropriate language or other behavior deemed
+unprofessional or unwelcome in the community.
+
+**Consequence**: A private, written warning from community leaders, providing
+clarity around the nature of the violation and an explanation of why the
+behavior was inappropriate. A public apology may be requested.
+
+### 2. Warning
+
+**Community Impact**: A violation through a single incident or series
+of actions.
+
+**Consequence**: A warning with consequences for continued behavior. No
+interaction with the people involved, including unsolicited interaction with
+those enforcing the Code of Conduct, for a specified period of time. This
+includes avoiding interaction in community spaces as well as external channels
+like social media. Violating these terms may lead to a temporary or
+permanent ban.
+
+### 3. Temporary Ban
+
+**Community Impact**: A serious violation of community standards, including
+sustained inappropriate behavior.
+
+**Consequence**: A temporary ban from any sort of interaction or public
+communication with the community for a specified period of time. No public or
+private interaction with the people involved, including unsolicited interaction
+with those enforcing the Code of Conduct, is allowed during this period.
+Violating these terms may lead to a permanent ban.
+
+### 4. Permanent Ban
+
+**Community Impact**: Demonstrating a pattern of violation of community
+standards, including sustained inappropriate behavior, harassment of an
+individual, or aggression toward or disparagement of classes of individuals.
+
+**Consequence**: A permanent ban from any sort of public interaction within
+the community.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage],
+version 2.0, available at
+[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
+
+[homepage]: https://www.contributor-covenant.org
+[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
diff --git a/README.md b/README.md
index e7c381635..d0e834df0 100644
--- a/README.md
+++ b/README.md
@@ -22,6 +22,7 @@ https://github.com/user-attachments/assets/d52515d1-cb04-4dd6-98bd-fef233312dc4
- [Architecture](#architecture)
- [Tech Stack](#tech-stack)
- [Getting Started](#getting-started)
+- [Contributing](#contributing)
- [Examples](#examples)
- [Tutorials](#tutorials)
- [Project Structure](#project-structure)
@@ -33,13 +34,91 @@ https://github.com/user-attachments/assets/d52515d1-cb04-4dd6-98bd-fef233312dc4
- [Memory](#memory)
- [Web Component & Embedding](#web-component--embedding)
- [Widget System](#widget-system)
-- [API Reference](#api-reference)
-- [Authentication & OAuth 2.1](#authentication--oauth-21)
-- [MCP Server](#mcp-server)
-- [On-Chain Identity (ERC-8004)](#on-chain-identity-erc-8004)
-- [Database Schema](#database-schema)
-- [Build & Deployment](#build--deployment)
-- [Environment Variables](#environment-variables)
+## API Reference
+
+The backend API is composed of Vercel serverless functions located in the `api/` directory. Key endpoints include:
+- `api/agents.js`: CRUD operations for agents.
+- `api/chat.js`: Handles LLM chat interactions.
+- `api/mcp.js`: The Model Context Protocol (MCP) endpoint.
+- `api/auth/`: User authentication and session management.
+- `api/payments/`: Payment processing.
+- `api/agent-actions.js`: Records agent actions.
+- `api/agent-memory.js`: Manages agent memory.
+
+An OpenAPI 3.1 specification is available at `/openapi.json`.
+
+---
+
+## Authentication & OAuth 2.1
+
+The platform includes a full OAuth 2.1 server for secure authentication and authorization. Key features include:
+- **Email & Wallet Sign-in**: Users can register and sign in with email or a crypto wallet (SIWE).
+- **OAuth 2.1 Flow**: Standard authorization code flow with PKCE.
+- **API Keys**: Developers can generate API keys with specific scopes and expiry dates.
+
+---
+
+## Build & Deployment
+
+The project is deployed on Vercel. The `package.json` file contains several scripts for building and deploying the application:
+- `npm run dev`: Starts the local development server.
+- `npm run build`: Builds the main application.
+- `npm run build:lib`: Builds the distributable library.
+- `npm run build:chat`: Builds the Svelte-based chat component.
+- `npm run build:rider`: Builds the `rider` sub-project.
+- `npm run build:all`: Runs all build scripts in parallel.
+- `npm run install:sdk`: Installs and builds the `agent-payments-sdk`.
+- `npm run deploy`: Deploys the project to Vercel.
+
+---
+
+## Claude CLI
+
+The `claude.sh` script is a command-line interface (CLI) to help manage the agent and SDKs. You can run it directly or via `npm run claude`.
+
+**Usage:**
+```bash
+# Using npm
+npm run claude -- [COMMAND]
+
+# Direct execution
+./claude.sh [COMMAND]
+```
+
+**Commands:**
+
+| Command | Description |
+| --- | --- |
+| `install-sdk` | Installs and builds the `@pump-fun/agent-payments-sdk`. This is a quick way to get your local environment set up with the necessary SDKs. |
+| `help` | Shows the help message, listing all available commands. |
+
+---
+
+## Environment Variables
+
+The following environment variables are required. Copy `.env.example` to `.env.local` and provide the values.
+
+| Variable | Description |
+| --- | --- |
+| `PUBLIC_APP_ORIGIN` | Public URL of the application. |
+| `DATABASE_URL` | Connection string for the Neon Postgres database. |
+| `S3_ENDPOINT` | Endpoint for the S3-compatible storage bucket. |
+| `S3_ACCESS_KEY_ID` | Access key ID for the S3 bucket. |
+| `S3_SECRET_ACCESS_KEY` | Secret access key for the S3 bucket. |
+| `S3_BUCKET` | Name of the S3 bucket. |
+| `S3_PUBLIC_DOMAIN` | Public CDN base URL for the S3 bucket. |
+| `UPSTASH_REDIS_REST_URL` | URL for the Upstash Redis instance. |
+| `UPSTASH_REDIS_REST_TOKEN` | Token for the Upstash Redis instance. |
+| `JWT_SECRET` | Secret key for signing JWTs. |
+| `ANTHROPIC_API_KEY` | API key for the Anthropic (Claude) LLM. |
+| `OPENROUTER_API_KEY` | API key for the OpenRouter free model proxy. |
+| `VITE_RPM_SUBDOMAIN` | Ready Player Me subdomain for the avatar creator. |
+| `VITE_PRIVY_APP_ID` | Privy app ID for client-side wallet authentication. |
+| `PRIVY_APP_ID` | Privy app ID for server-side token verification. |
+| `AVATURN_API_KEY` | API key for the Avaturn photo-to-avatar pipeline. |
+| `AGENT_RELAYER_KEY` | Private key for the ERC-7710 delegation relayer. |
+| `AGENT_RELAYER_ADDRESS` | Public address of the relayer. |
+| `RPC_URL_<CHAINID>` | RPC URLs for different blockchain networks. |
- [Cloud Marketplaces](#cloud-marketplaces)
- [Testing](#testing)
- [Contributing](#contributing)
@@ -323,125 +402,64 @@ The backend is stateless serverless functions. All persistent state lives in Pos
## Tech Stack
**Frontend**
-| Technology | Version | Purpose |
-|---|---|---|
-| three.js | r176 | WebGL 2.0 rendering |
-| Vite | 7.3.2 | Build tooling + HMR |
-| Vitest | 4.1.4 | Unit testing |
-| viem | 2.18.0 | Ethereum wallet + SIWE |
-| ethers | 6.16.0 | Contract interaction |
-| @solana/web3.js | 1.98.4 | Solana RPC + signing |
-| jose | 5.9.6 | JWT handling |
-| zod | 3.23.8 | Schema validation |
-| gltf-validator | 2.0.0-dev.3.10 | Khronos spec compliance |
-| dat.gui | 0.7.9 | Real-time parameter UI |
-| simple-dropzone | 0.8.3 | Drag-and-drop file handling |
-| vhtml | 2.2.0 | JSX → HTML string rendering |
-
-**Backend (Vercel serverless)**
-| Technology | Purpose |
-|---|---|
-| Neon Postgres | Primary database |
-| Cloudflare R2 | Avatar / model object storage |
-| Upstash Redis | Rate limiting |
-| Anthropic SDK | Claude LLM (claude-sonnet-4-6 / claude-opus-4-7) |
-| Resend | Transactional email |
-| Sentry | Error monitoring |
-| @aws-sdk/client-s3 | R2 presigned upload URLs |
+- **Main UI**: The core application, including the 3D viewer, agent creation, and marketplace, is built with vanilla JavaScript modules and Vite.
+- **Chat**: The chat interface is a standalone Svelte application located in the `chat/` directory.
+- **3D Rendering**: three.js (r176) is used for WebGL 2.0 rendering.
+
+**Backend (Vercel Serverless)**
+- **Runtime**: Node.js
+- **Database**: Neon Postgres (serverless)
+- **Storage**: Cloudflare R2 for model and avatar storage.
+- **Rate Limiting**: Upstash Redis.
+- **LLM**: The agent's brain is powered by the Anthropic (Claude) SDK.
**Smart Contracts**
-| Technology | Purpose |
-|---|---|
-| Solidity 0.8+ | ERC-8004 contracts |
-| Foundry | Compile, test, deploy |
-| ERC-721 | Agent token standard |
-| EIP-712 | Typed structured signing |
-| EIP-7710 | Delegated permissions |
+- **Language**: Solidity 0.8+
+- **Framework**: Foundry for compiling, testing, and deploying the ERC-8004 contracts.
+- **Standards**: ERC-721, EIP-712, EIP-7710.
---
## Getting Started
-### Use the embeddable web component (no setup)
-
-Install from npm:
-
-```bash
-npm install three.ws
-```
-
-```js
-import 'three.ws';
-// <agent-3d src="/path/to/avatar.glb"></agent-3d>
-```
-
-Or load via CDN:
-
-```html
-<script type="module" src="https://unpkg.com/three.ws"></script>
-<agent-3d src="/path/to/avatar.glb"></agent-3d>
-```
-
-Package: https://www.npmjs.com/package/three.ws
-
-### Run the full platform locally
-
-#### Prerequisites
-
+### Prerequisites
- Node.js 20+
- npm 10+
-- A Neon Postgres database (or any Postgres 15+)
-- A Cloudflare R2 bucket (or any S3-compatible store)
-- An Anthropic API key (for the LLM backend)
-
-#### Installation
-
-```bash
-git clone https://github.com/nirholas/3D-Agent.git
-cd 3D-Agent
-npm install
-```
-
-### Environment Setup
-
-Copy the example env file and fill in required values:
-
-```bash
-cp .env.example .env.local
-```
-
-At minimum, set:
+- A Neon Postgres database
+- A Cloudflare R2 bucket
+- An Anthropic API key
+
+### Installation and Setup
+1. **Clone the repository**:
+ ```bash
+ git clone https://github.com/nirholas/3D-Agent.git
+ cd 3D-Agent
+ ```
+2. **Install dependencies**:
+ ```bash
+ npm install
+ ```
+3. **Set up environment variables**:
+ Copy the `.env.example` file to `.env.local` and fill in the required values. See the [Environment Variables](#environment-variables) section for more details.
+ ```bash
+ cp .env.example .env.local
+ ```
+4. **Initialize the database**:
+ The schema is idempotent. Run it against your Postgres instance to create all tables:
+ ```bash
+ psql $DATABASE_URL < api/_lib/schema.sql
+ ```
+5. **Run the development server**:
+ ```bash
+ npm run dev
+ ```
+The application will be available at `http://localhost:3000`.
-```env
-PUBLIC_APP_ORIGIN=http://localhost:3000
-DATABASE_URL=postgres://user:pass@host/db
-JWT_SECRET=<run: openssl rand -base64 64>
-ANTHROPIC_API_KEY=sk-ant-...
-```
-
-See [Environment Variables](#environment-variables) for the full reference.
-
-### Initialize the Database
-
-The schema is idempotent — run it against your Postgres instance to create all tables:
-
-```bash
-psql $DATABASE_URL < api/_lib/schema.sql
-```
-
-### Start the Dev Server
-
-```bash
-npm run dev
-```
-
-Opens at `http://localhost:3000`. The landing page is at `/`, the viewer at `/app`, the user dashboard at `/dashboard`, and the agent creation flow at `/create`. For the full list of routes, see [docs/internal/PAGES.md](docs/internal/PAGES.md).
-
-### Quick Viewer Test
+---
-Navigate to `http://localhost:3000/app` and drag any GLB file onto the canvas. The model loads instantly with PBR materials, animations, and full glTF validation.
+## Contributing
-To try the agent, navigate to `/create`, upload a GLB, and configure a brain (requires `ANTHROPIC_API_KEY` in your env).
+We welcome contributions from the community! Please read our [contributing guidelines](CONTRIBUTING.md) to get started.
---
@@ -638,7 +656,7 @@ For anything beyond a quick one-liner, define the agent in a manifest file and r
"skills": [
{ "uri": "https://cdn.three.ws/skills/wave/" }
]
-}
+} The script automatically initializes widgets, even those added dynamically after the page loads.
```
```html
@@ -698,100 +716,53 @@ For sandboxed iframes use the widget embed path instead — it runs in its own b
## Project Structure
-```
-3D-Agent/
-├── home.html # Landing page (served at /)
-├── index.html # Legacy marketing page
-├── app.html # Main viewer (drag-and-drop + /deploy alias)
-├── create.html # Avatar + agent creation wizard
-├── profile.html # User profile (/profile, /u/[username])
-├── avatar-page.html # Public avatar detail (/avatars/[id])
-├── agent-home.html # Agent detail & action timeline
-├── agent-edit.html # Agent editing UI
-├── agent-embed.html # Chromeless embed variant
-├── a-edit.html # On-chain agent edit
-├── a-embed.html # On-chain agent embed
-│
-├── src/ # Frontend JavaScript (~80 modules, ~15k lines)
-│ ├── viewer.js # three.js renderer core (1,534 lines)
-│ ├── app.js # SPA entry + URL routing (460 lines)
-│ ├── agent-protocol.js # Event bus (200-action ring buffer)
-│ ├── agent-avatar.js # Empathy Layer (morph targets, emotion) (694 lines)
-│ ├── agent-identity.js # Passport, diary, signed action history
-│ ├── element.js # <agent-3d> custom element
-│ ├── runtime/
-│ │ ├── index.js # LLM tool-loop engine
-│ │ ├── providers.js # AnthropicProvider, NullProvider
-│ │ ├── scene.js # SceneController bridge to three.js
-│ │ ├── tools.js # Built-in tools (wave, speak, remember...)
-│ │ └── speech.js # TTS + STT
-│ ├── memory/
-│ │ └── index.js # File-based memory (local/ipfs/encrypted-ipfs/none)
-│ ├── skills/
-│ │ ├── index.js # SkillRegistry
-│ │ └── <name>/ # Bundled skills (SKILL.md, tools.json, handlers.js)
-│ ├── erc8004/
-│ │ ├── abi.js # Contract ABIs + deployment addresses
-│ │ ├── agent-registry.js # connectWallet, registerAgent, pinToIPFS
-│ │ └── reputation.js # submitFeedback, getReputation
-│ └── widgets/ # Five widget type implementations
-│
-├── api/ # Vercel serverless functions (~153 endpoints, ~3.6k lines)
-│ ├── agents.js # Agent CRUD (321 lines)
-│ ├── chat.js # LLM chat endpoint (298 lines)
-│ ├── mcp.js # MCP server over HTTP (759 lines)
-│ ├── agent-actions.js # Record signed actions (122 lines)
-│ ├── agent-memory.js # Memory CRUD + recall (188 lines)
-│ ├── auth/ # Login, register, SIWE, Privy, sessions
-│ ├── oauth/ # OAuth 2.1 server (authorize, token, register...)
-│ ├── avatars/ # Avatar CRUD + presigned upload
-│ ├── widgets/ # Widget CRUD + OG + oEmbed
-│ ├── erc8004/ # Blockchain hydrate, import, pin
-│ ├── cron/ # Scheduled jobs (crawl, DCA, subscriptions)
-│ └── _lib/ # Shared helpers (db, auth, r2, validate, email...)
-│ └── schema.sql # Idempotent Postgres migrations
-│
-├── public/ # Static subapps + assets
-│ ├── studio/ # Widget Studio SPA
-│ ├── dashboard/ # User dashboard SPA (actions, sessions, storage, usage, wallets, embed-policy, agent-pumpfun)
-│ ├── settings/ # Account settings
-│ ├── admin/ # Staff admin surface
-│ ├── validation/ # glTF validator tool
-│ ├── discover/ # Agent discovery SPA
-│ ├── my-agents/ # Owner agent list
-│ ├── reputation/ # Reputation registry browser
-│ ├── widgets-gallery/ # Public widget gallery
-│ ├── hydrate/ # Import on-chain agent
-│ ├── features/ # Features marketing page
-│ ├── first-meet/ # First-time-user onboarding
-│ ├── artifact/ # Claude Artifact viewer bundle
-│ ├── cz/ # CZ demo experience
-│ ├── lobehub/iframe/ # LobeHub plugin surface
-│ ├── pumpfun.html # pump.fun token launcher
-│ ├── vanity-wallet.html # Solana vanity-address grinder
-│ ├── strategy-lab.html # DCA strategy designer
-│ ├── agent-passport.html # Solana agent passport
-│ ├── login.html, register.html, forgot-password.html, reset-password.html
-│ └── animations/ # Animation clip library
-│
-├── contracts/ # Foundry + Solidity (ERC-8004)
-│ ├── src/
-│ │ ├── IdentityRegistry.sol # ERC-721 agent tokens (EIP-712)
-│ │ ├── ReputationRegistry.sol # Signed reviewer feedback
-│ │ └── ValidationRegistry.sol # Validator attestations
-│ ├── script/Deploy.s.sol
-│ ├── test/IdentityRegistry.test.sol
-│ └── DEPLOYMENTS.md # Chain deployment addresses
-│
-├── docs/ # Architecture, API, deployment guides (see internal/PAGES.md for full route audit)
-├── specs/ # Formal specs (manifest, embed, skill, memory...)
-├── tests/ # Vitest test suite (~30 files)
-├── scripts/ # Build tools (publish, icon gen, animations)
-│
-├── vite.config.js # App build config
-├── vite.config.artifact.js # Standalone artifact bundle
-├── vercel.json # Routes, rewrites, crons, headers
-└── package.json # Scripts + dependencies
+- `src/`: The core frontend JavaScript for the main application, including the 3D viewer, agent protocol, and custom element.
+- `api/`: Vercel serverless functions that form the backend API.
+- `public/`: Static assets and various sub-applications.
+- `chat/`: A standalone Svelte application for the chat interface.
+- `character-studio/`: A sub-project for character creation.
+- `rider/`: A-Frame WebVR music visualization experiment.
+- `contracts/`: Solidity smart contracts for on-chain identity (ERC-8004).
+- `agent-payments-sdk/`: SDK for agent-related payments.
+- `solana-agent-sdk/`: SDK for Solana blockchain interactions.
+- `pump-fun-skills/`: Skills related to the pump.fun integration.
+- `scripts/`: Node.js scripts for development, build, and deployment tasks.
+- `workers/`: Code for background workers.
+
+---
+
+## Pump.fun Integration
+
+This project includes a significant integration with [pump.fun](https://pump.fun), a platform for launching tokens on Solana. Key features include:
+- **Token Launcher**: A UI for creating and launching new tokens on pump.fun, available at `public/pumpfun.html`.
+- **Live Dashboard**: Real-time tracking of pump.fun tokens can be found in `pump-live.html`.
+- **Skills**: The `pump-fun-skills/` directory contains agent skills for interacting with pump.fun.
+
+---
+
+## SDKs
+
+The project contains several SDKs to interact with various services:
+- **`agent-payments-sdk/`**: Manages payments for agent-related services.
+- **`solana-agent-sdk/`**: Provides tools for interacting with the Solana blockchain.
+- **`sdk/`**: A general-purpose SDK with shared utilities.
+
+---
+
+## Workers
+
+The `workers/` directory contains code for background workers that handle tasks such as scheduled jobs and data processing.
+
+---
+
+## Scripts and Tooling
+
+The `scripts/` directory includes various utility scripts:
+- `seed-skills.js`: Seeds the database with an initial set of agent skills.
+- `apply-migrations.mjs`: Manages and applies database migrations.
+- `publish-lib.mjs`: Publishes the library to npm.
+- `download-animations.mjs`: Fetches and updates animation files.
+- `build-animations.mjs`: Builds animation assets.
```
---
diff --git a/a-embed.html b/a-embed.html
index 0fb39cb91..f9cff4b88 100644
--- a/a-embed.html
+++ b/a-embed.html
@@ -162,6 +162,17 @@
if (bg === 'dark') document.body.classList.add('bg-dark');
if (bg === 'light') document.body.classList.add('bg-light');
+ const avatar = params.get('avatar');
+
+ if (avatar) {
+ const viewer = new Viewer({
+ el: document.getElementById('stage'),
+ model: avatar,
+ });
+ document.getElementById('loading').style.display = 'none';
+ return;
+ }
+
const plateOn = params.get('name') !== '0';
const chainOn = params.get('chain-plate') !== '0';
const openLinkOn = params.get('open-link') !== '0';
diff --git a/agent-detail.html b/agent-detail.html
index 702f1c009..2e7040a2a 100644
--- a/agent-detail.html
+++ b/agent-detail.html
@@ -1,28 +1,92 @@
-<!doctype html>
-<html lang="en">
- <head>
- <meta charset="utf-8" />
- <title>Agent — three.ws</title>
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <meta name="theme-color" content="#0b0d10" />
- <link rel="shortcut icon" href="/favicon.ico" />
- <link rel="preconnect" href="https://fonts.googleapis.com" />
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap"
rel="stylesheet"
/>
<link rel="stylesheet" href="/src/agent-detail.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrious/4.0.2/qrious.min.js"></script>
+ <style>
+ .ad-main.loading .ad-hero-avatar,
+ .ad-main.loading .ad-hero-body > *,
+ .ad-main.loading .ad-card .ad-row,
+ .ad-main.loading .ad-card .ad-balance,
+ .ad-main.loading .ad-card .ad-services,
+ .ad-main.loading .ad-card .ad-token-body,
+ .ad-main.loading .ad-card .ad-trust-pills,
+ .ad-main.loading .ad-card .ad-protocols,
+ .ad-main.loading .ad-card .ad-sub,
+ .ad-main.loading .ad-card .ad-cta-row {
+ visibility: hidden;
+ }
+
+ .skeleton {
+ background-color: #2a2a3a;
+ border-radius: 4px;
+ animation: skeleton-pulse 1.5s infinite ease-in-out;
+ }
+
+ @keyframes skeleton-pulse {
+ 0% { background-color: #2a2a3a; }
+ 50% { background-color: #3a3a4a; }
+ 100% { background-color: #2a2a3a; }
+ }
+
+ .ad-main.loading .ad-hero-avatar {
+ visibility: visible; /* Keep the container visible */
+ background-color: #2a2a3a;
+ border-radius: 50%;
+ width: 120px;
+ height: 120px;
+ }
+ .ad-main.loading #ad-name-skeleton { display: block; }
+ .ad-main.loading #ad-meta-skeleton { display: block; }
+ .ad-main.loading #ad-desc-skeleton { display: block; }
+
+ .ad-main.loading .ad-card .skeleton-row {
+ display: flex;
+ justify-content: space-between;
+ margin-bottom: 0.5rem;
+ }
+
+ .ad-main.loading .ad-card .skeleton-text {
+ height: 1em;
+ width: 70%;
+ }
+ .ad-main.loading .ad-card .skeleton-text-short {
+ width: 30%;
+ }
+
+ </style>
</head>
<body>
<div class="ad-shell">
+ <div id="withdraw-modal" class="ad-modal-overlay hidden">
+ <div class="ad-modal">
+ <div class="ad-modal-header">
+ <h3>Withdraw SOL</h3>
+ <button id="close-modal-btn" class="ad-modal-close">&times;</button>
+ </div>
+ <div class="ad-modal-body">
+ <div class="ad-form-group">
+ <label for="withdraw-amount">Amount (SOL)</label>
+ <input type="number" id="withdraw-amount" class="ad-input" placeholder="0.0">
+ </div>
+ <div class="ad-form-group">
+ <label for="recipient-address">Recipient Address</label>
+ <input type="text" id="recipient-address" class="ad-input" placeholder="Enter wallet address">
+ </div>
+ </div>
+ <div class="ad-modal-footer">
+ <button id="cancel-withdraw-btn" class="ad-btn">Cancel</button>
+ <button id="confirm-withdraw-btn" class="ad-btn ad-btn-primary">Confirm Withdraw</button>
+ </div>
+ </div>
+ </div>
<aside class="ad-sidebar">
<div class="ad-brand">three.ws</div>
<nav class="ad-nav">
<a href="/">Home</a>
<a href="/leaderboard">Leaderboard</a>
- <a class="active" href="/agents">Agents <span class="ad-beta">BETA</span></a>
+ <a class="active" href="/marketplace.html">Agents <span class="ad-beta">BETA</span></a>
<a href="/spotlight">Apply for Spotlight</a>
<a href="/developers">Developers</a>
<a href="/about">About</a>
@@ -34,7 +98,7 @@
</div>
</aside>
- <main class="ad-main">
+ <main class="ad-main loading">
<header class="ad-banner">
<span>S1 Powered by Torque · $250K rewards</span>
</header>
@@ -54,7 +118,8 @@
<img class="ad-hero-avatar" id="ad-avatar" alt="" />
<div class="ad-hero-body">
<div class="ad-hero-title">
- <h1 id="ad-name">Loading…</h1>
+ <h1 id="ad-name"></h1>
+ <div id="ad-name-skeleton" class="skeleton" style="width: 200px; height: 36px; display: none;"></div>
<span class="ad-status" id="ad-status">Active</span>
</div>
<div class="ad-hero-meta">
@@ -63,7 +128,9 @@
<span class="ad-dot">·</span>
<span id="ad-asset-kind">Core Asset</span>
</div>
+ <div id="ad-meta-skeleton" class="skeleton" style="width: 150px; height: 16px; margin-top: 8px; display: none;"></div>
<p class="ad-hero-desc" id="ad-desc"></p>
+ <div id="ad-desc-skeleton" class="skeleton" style="width: 80%; height: 48px; margin-top: 8px; display: none;"></div>
<div class="ad-hero-trust" id="ad-trust-pills"></div>
</div>
</section>
diff --git a/api/README.md b/api/README.md
new file mode 100644
index 000000000..f317d6e5c
--- /dev/null
+++ b/api/README.md
@@ -0,0 +1,11 @@
+# API
+
+This directory contains all the backend API endpoints for the 3D-Agent application.
+
+## Structure
+
+The API is structured by modules, with each module handling a specific part of the application's functionality.
+
+## Getting Started
+
+To get started with the API, you will need to...
diff --git a/api/marketplace/[action].js b/api/marketplace/[action].js
index d24f1a603..9d37af1d0 100644
--- a/api/marketplace/[action].js
+++ b/api/marketplace/[action].js
@@ -267,12 +267,14 @@ async function handleList(req, res, url) {
SELECT ai.id, ai.name, ai.description, ai.category, ai.tags, ai.avatar_id, ai.user_id,
ai.forks_count, ai.views_count, ai.published_at, ai.created_at, ai.skills,
av.thumbnail_key,
+ u.display_name AS author_name,
EXISTS (
SELECT 1 FROM agent_skill_prices asp
WHERE asp.agent_id = ai.id AND asp.is_active = true
) AS has_paid_skills
FROM agent_identities ai
LEFT JOIN avatars av ON av.id = ai.avatar_id AND av.deleted_at IS NULL
+ LEFT JOIN users u ON u.id = ai.user_id
WHERE ai.is_published = true
AND ai.deleted_at IS NULL
AND (${cat}::text IS NULL OR ai.category = ${cat})
diff --git a/app.html b/app.html
index 4bff47910..3430a0463 100644
--- a/app.html
+++ b/app.html
@@ -62,68 +62,9 @@
><img class="wordmark-logo" src="/three.svg" alt="" aria-hidden="true" /><span class="wordmark-dot" aria-hidden="true"></span>three.ws</a
>
</h1>
- <nav class="features-nav" aria-label="Primary">
- <ul class="nav-root" role="menubar">
- <li class="nav-item nav-has-menu" role="none">
- <button
- type="button"
- class="nav-trigger"
- aria-haspopup="true"
- aria-expanded="false"
- role="menuitem"
- >
- Build<span class="nav-caret" aria-hidden="true">▾</span>
- </button>
- <ul class="nav-menu" role="menu" aria-label="Build">
- <li role="none">
- <a href="/create" role="menuitem"
- ><span class="nav-mi-title">Create agent</span
- ><span class="nav-mi-sub">Avatar + brain wizard</span></a
- >
- </li>
- <li role="none">
- <a href="/app" role="menuitem"
- ><span class="nav-mi-title">Viewer</span
- ><span class="nav-mi-sub">Drag-and-drop GLB</span></a
- >
- </li>
- <li role="none">
- <a href="/validation" role="menuitem"
- ><span class="nav-mi-title">glTF Validator</span
- ><span class="nav-mi-sub">Khronos spec check</span></a
- >
- </li>
- </ul>
- </li>
- <li role="none"><a href="/discover" role="menuitem">Discover</a></li>
- <li class="nav-item nav-has-menu" role="none">
- <button
- type="button"
- class="nav-trigger"
- aria-haspopup="true"
- aria-expanded="false"
- role="menuitem"
- >
- Solana<span class="nav-caret" aria-hidden="true">▾</span>
- </button>
- <ul class="nav-menu" role="menu" aria-label="Solana">
- <li role="none">
- <a href="/pumpfun" role="menuitem"
- ><span class="nav-mi-title">Pump.fun stream</span
- ><span class="nav-mi-sub">Mint agent tokens</span></a
- >
- </li>
- <li role="none">
- <a href="/vanity-wallet" role="menuitem"
- ><span class="nav-mi-title">Vanity wallet</span
- ><span class="nav-mi-sub">Generate address</span></a
- >
- </li>
- </ul>
- </li>
- <li class="nav-item" role="none"><a href="/marketplace.html" role="menuitem">Marketplace</a></li>
- </ul>
- </nav>
+ <div id="nav-container"></div>
+ </header>
+ <script src="/nav.js"></script>
id="make-widget-btn"
href="/studio"
hidden
diff --git a/avatar-page.html b/avatar-page.html
index b43175e9e..b0a1741d7 100644
--- a/avatar-page.html
+++ b/avatar-page.html
@@ -194,11 +194,313 @@
color: rgba(255, 255, 255, 0.6);
}
+ .av-social-btn {
+ background: transparent;
+ border: 1px solid rgba(255, 255, 255, 0.12);
+ color: rgba(255, 255, 255, 0.6);
+ padding: 0.5rem;
+ }
+
+ .av-embed {
+ margin-top: 2rem;
+ }
+
+ .av-embed-label {
+ font-size: 0.764rem;
+ color: rgba(255, 255, 255, 0.5);
+ font-weight: 500;
+ margin-bottom: 0.5rem;
+ display: block;
+ }
+
+ .av-embed-code {
+ background: rgba(255, 255, 255, 0.04);
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ border-radius: 8px;
+ padding: 0.75rem 1rem;
+ font-family: monospace;
+ font-size: 0.764rem;
+ color: rgba(255, 255, 255, 0.7);
+ word-break: break-all;
+ position: relative;
+ padding-right: 4rem;
+ }
+
+ .av-embed-copy-btn {
+ position: absolute;
+ top: 0.5rem;
+ right: 0.5rem;
+ background: rgba(255, 255, 255, 0.1);
+ border: 1px solid rgba(255, 255, 255, 0.2);
+ color: rgba(255, 255, 255, 0.7);
+ font-size: 0.618rem;
+ padding: 0.25rem 0.618rem;
+ border-radius: 6px;
+ cursor: pointer;
+ }
+
+ .av-embed-copy-btn.copied {
+ color: #4ade80;
+ border-color: rgba(74, 222, 128, 0.3);
+ }
+
.av-meta {
font-size: 0.618rem;
color: rgba(255, 255, 255, 0.2);
margin-top: 1rem;
}
+ </style>
+ </head>
+ <body>
+ <header class="av-header">
+ <a href="/" aria-label="Back to three.ws">← three.ws</a>
+ <button class="av-copy-btn" id="copy-btn">copy link</button>
+ </header>
+
+ <main>
+ <div class="av-root" id="av-root">
+ <div class="av-error">Loading…</div>
+ </div>
+ </main>
+
+ <footer class="h-footer-horizon">
+ <div class="h-footer-glow-line" aria-hidden="true"></div>
+ <div class="h-footer-floor" aria-hidden="true"></div>
+ <div class="h-footer-haze" aria-hidden="true"></div>
+ <div class="h-footer-watermark" aria-hidden="true">three.ws</div>
+ <div class="h-footer-cta">
+ <div class="h-footer-newsletter">
+ <h3>Stay in the loop</h3>
+ <p>Get updates on new features, agent tooling, and protocol changes.</p>
+ <form class="h-footer-newsletter-form" data-newsletter-form novalidate>
+ <input
+ type="email"
+ class="h-footer-newsletter-input"
+ name="email"
+ placeholder="Enter your email"
+ aria-label="Email address"
+ autocomplete="email"
+ required
+ />
+ <button type="submit" class="h-footer-newsletter-btn" aria-label="Subscribe">
+ <svg viewBox="0 0 16 16" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" d="M2 8h11m0 0L9 4m4 4l-4 4"/></svg>
+ </button>
+ </form>
+ <p class="h-footer-newsletter-msg" data-newsletter-msg aria-live="polite"></p>
+ </div>
+ <div class="h-footer-community">
+ <h3>Join the community</h3>
+ <p>Follow along for builds, demos, and conversations with the team.</p>
+ <a class="h-footer-community-btn" href="https://x.com/trythreews" target="_blank" rel="noopener">
+ <svg viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg>
+ Follow on X
+ </a>
+ </div>
+ </div>
+ <div class="h-footer-inner">
+ <div class="h-footer-brand-col">
+ <div class="h-footer-brand">
+ <img class="wordmark-logo" src="/three.svg" alt="" aria-hidden="true" />
+ <span class="wordmark-dot" aria-hidden="true"></span>
+ <span>three.ws</span>
+ </div>
+ <p class="h-footer-tagline">Give your AI a body.</p>
+ <div class="h-footer-socials">
+ <a class="h-footer-social" href="https://x.com/trythreews" target="_blank" rel="noopener" aria-label="three.ws on X">
+ <svg viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg>
+ </a>
+ <a class="h-footer-social" href="https://github.com/nirholas/three.ws" target="_blank" rel="noopener" aria-label="three.ws on GitHub">
+ <svg viewBox="0 0 16 16" aria-hidden="true"><path fill="currentColor" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>
+ </a>
+ </div>
+ </div>
+ <nav class="h-footer-links" aria-label="Footer">
+ <div class="h-footer-link-col">
+ <h4 class="h-footer-link-heading">Product</h4>
+ <a href="/create">Create</a>
+ <a href="/studio">Studio</a>
+ <a href="/widgets">Widgets</a>
+ <a href="/discover">Discover</a>
+ </div>
+ <div class="h-footer-link-col">
+ <h4 class="h-footer-link-heading">Developers</h4>
+ <a href="/docs">Docs</a>
+ <a href="https://github.com/nirholas/three.ws" target="_blank" rel="noopener">GitHub</a>
+ <a href="https://eips.ethereum.org/EIPS/eip-8004" target="_blank" rel="noopener">ERC-8004</a>
+ </div>
+ <div class="h-footer-link-col">
+ <h4 class="h-footer-link-heading">Resources</h4>
+ <a href="/features">Features</a>
+ <a href="/dashboard">Dashboard</a>
+ </div>
+ </nav>
+ </div>
+ <div class="h-footer-bottom">
+ <p class="h-footer-legal">© 2026 three.ws — All rights reserved.</p>
+ <div class="h-footer-legal-links">
+ <a href="/legal/privacy">Privacy Policy</a>
+ <a href="/legal/tos">Terms of Use</a>
+ </div>
+ </div>
+ </footer>
+
+ <script type="module">
+ const esc = (s) =>
+ String(s ?? '').replace(
+ /[&<>"']/g,
+ (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c],
+ );
+
+ const root = document.getElementById('av-root');
+ const segments = location.pathname.split('/').filter(Boolean);
+ const id = segments[1]; // /avatars/<id>
+
+ if (!id) {
+ root.innerHTML = `<div class="av-error">No avatar specified.</div>`;
+ } else {
+ load(id);
+ }
+
+ async function load(avatarId) {
+ let avatar;
+ try {
+ const res = await fetch(`/api/avatars/${encodeURIComponent(avatarId)}`);
+ if (!res.ok) {
+ const data = await res.json().catch(() => ({}));
+ throw new Error(data.error_description || res.statusText);
+ }
+ avatar = (await res.json()).avatar;
+ } catch (err) {
+ root.innerHTML = `<div class="av-error">${esc(err.message)}</div>`;
+ return;
+ }
+
+ if (!avatar.model_url) {
+ root.innerHTML = `<div class="av-error">This avatar is private.</div>`;
+ return;
+ }
+
+ // OG / title
+ document.title = `${avatar.name} — three.ws`;
+ document.querySelector('#og-title')?.setAttribute('content', avatar.name);
+ document.querySelector('#og-description')?.setAttribute(
+ 'content',
+ avatar.description || `A 3D avatar on three.ws`,
+ );
+ document.querySelector('#og-url')?.setAttribute('content', location.href);
+ document.querySelector('#tw-title')?.setAttribute('content', avatar.name);
+ document.querySelector('#tw-description')?.setAttribute(
+ 'content',
+ avatar.description || `A 3D avatar on three.ws`,
+ );
+ if (avatar.thumbnail_url) {
+ document.querySelector('#og-image')?.setAttribute('content', avatar.thumbnail_url);
+ }
+
+ const tagsHtml = (avatar.tags || [])
+ .map((t) => `<span class="av-tag">${esc(t)}</span>`)
+ .join('');
+
+ const byLine = avatar.owner_username
+ ? `<p class="av-by">by <a href="/u/${esc(avatar.owner_username)}">@${esc(avatar.owner_username)}</a></p>`
+ : '';
+
+ const sizeStr = avatar.size_bytes
+ ? `${(avatar.size_bytes / 1_048_576).toFixed(1)} MB`
+ : '';
+ const dateStr = avatar.created_at
+ ? new Date(avatar.created_at).toLocaleDateString()
+ : '';
+
+ const embedCode = `<script type="module" src="https://three.ws/dist-lib/agent-3d.js"></script>
+<agent-3d src="${esc(avatar.model_url)}"></agent-3d>`;
+
+ root.innerHTML = `
+ <div class="av-layout">
+ <div class="av-viewer">
+ <model-viewer
+ src="${esc(avatar.model_url)}"
+ camera-controls
+ auto-rotate
+ rotation-per-second="12deg"
+ shadow-intensity="1"
+ exposure="1"
+ tone-mapping="aces"
+ ></model-viewer>
+ </div>
+ <div class="av-info">
+ <h1 class="av-name">${esc(avatar.name)}</h1>
+ ${byLine}
+ ${avatar.description ? `<p class="av-desc">${esc(avatar.description)}</p>` : ''}
+ ${tagsHtml ? `<div class="av-tags">${tagsHtml}</div>` : ''}
+ <div class="av-actions">
+ <a class="av-btn av-btn-primary" href="/dashboard">Use this avatar</a>
+ <a class="av-btn av-btn-sec" href="${esc(avatar.model_url)}" download>Download GLB</a>
+ <a class="av-btn av-social-btn" id="twitter-share" href="#" target="_blank" rel="noopener">
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg>
+ </a>
+ <a class="av-btn av-social-btn" id="discord-share" href="#" target="_blank" rel="noopener">
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M20.317 4.369a19.791 19.791 0 00-4.885-1.515.074.074 0 00-.079.037c-.21.369-.42.738-.609 1.114a18.332 18.332 0 00-5.484 0 18.275 18.275 0 00-.61-1.114.074.074 0 00-.078-.037A19.79 19.79 0 003.683 4.37a.074.074 0 00-.036.079C3.336 5.623 2.92 9.444 3.483 12.164a.074.074 0 00.045.065c1.766.993 3.535 1.488 5.303 1.545a.073.073 0 00.063-.036c.143-.236.286-.492.409-.758a.074.074 0 00-.028-.086 15.655 15.655 0 01-1.788-.594.074.074 0 01-.018-.114c.06-.086.118-.171.178-.257a.074.074 0 01.092-.019c.357.143.714.267 1.07.391a.074.074 0 00.079-.018c.952-.515 1.838-1.133 2.659-1.84a.074.074 0 00.018-.1c-.347-.276-.694-.572-1.022-.888a.074.074 0 00-.102.009c-.046.046-.092.093-.138.139a.074.074 0 00-.009.102 14.122 14.122 0 01-1.921.605.074.074 0 00-.018.114c.06.086.118.171.178.257a.074.074 0 00.093-.018c1.328-.535 2.529-1.258 3.599-2.158a.074.074 0 00.018-.093c-.086-.143-.171-.286-.257-.429a.074.074 0 00-.092-.028c-1.133.391-2.285.714-3.456.952a.074.074 0 00-.054.065c-.009.046-.018.093-.018.139a13.315 13.315 0 00.018 1.458.074.074 0 00.054.065c2.4.456 4.829.357 6.942-.456a.074.074 0 00.045-.065c.562-2.719.147-6.54-.162-8.08a.074.074 0 00-.036-.079zm-4.733 8.322a2.448 2.448 0 01-2.448-2.448 2.448 2.448 0 012.448-2.448 2.448 2.448 0 012.448 2.448 2.448 2.448 0 01-2.448 2.448zm-6.289 0a2.448 2.448 0 01-2.448-2.448 2.448 2.448 0 012.448-2.448 2.448 2.448 0 012.448 2.448 2.448 2.448 0 01-2.448 2.448z" /></svg>
+ </a>
+ </div>
+ <p class="av-meta">${[sizeStr, avatar.source, dateStr].filter(Boolean).join(' · ')}</p>
+
+ <div class="av-embed">
+ <label class="av-embed-label">Embed Code</label>
+ <div class="av-embed-code" id="embed-code">
+ ${esc(embedCode)}
+ <button class="av-embed-copy-btn" id="embed-copy-btn">Copy</button>
+ </div>
+ </div>
+ </div>
+ </div>
+ `;
+
+ // Add event listeners for the new buttons
+ document.getElementById('twitter-share').addEventListener('click', (e) => {
+ e.preventDefault();
+ const text = `Check out this 3D avatar: ${avatar.name}`;
+ const url = `https://twitter.com/intent/tweet?text=${encodeURIComponent(text)}&url=${encodeURIComponent(location.href)}`;
+ window.open(url, '_blank');
+ });
+
+ document.getElementById('discord-share').addEventListener('click', (e) => {
+ e.preventDefault();
+ // Note: Discord doesn't have a direct share link, so we'll just copy the link
+ navigator.clipboard.writeText(location.href);
+ alert('Link copied to clipboard for sharing on Discord!');
+ });
+
+ document.getElementById('embed-copy-btn').addEventListener('click', async () => {
+ const btn = document.getElementById('embed-copy-btn');
+ try {
+ await navigator.clipboard.writeText(embedCode);
+ btn.textContent = 'Copied ✓';
+ btn.classList.add('copied');
+ setTimeout(() => {
+ btn.textContent = 'Copy';
+ btn.classList.remove('copied');
+ }, 1800);
+ } catch {}
+ });
+ }
+
+ // Copy link button
+ document.getElementById('copy-btn').addEventListener('click', async () => {
+ const btn = document.getElementById('copy-btn');
+ try {
+ await navigator.clipboard.writeText(location.href);
+ btn.textContent = 'copied ✓';
+ btn.classList.add('copied');
+ setTimeout(() => {
+ btn.textContent = 'copy link';
+ btn.classList.remove('copied');
+ }, 1800);
+ } catch {}
+ });
+ </script>
+ </body>
+</html>
.av-error {
text-align: center;
diff --git a/character-studio/README.md b/character-studio/README.md
new file mode 100644
index 000000000..5725da563
--- /dev/null
+++ b/character-studio/README.md
@@ -0,0 +1,7 @@
+# Character Studio
+
+This directory contains the Character Studio application.
+
+## Overview
+
+...
diff --git a/claude.sh b/claude.sh
new file mode 100644
index 000000000..6c57a8dbe
--- /dev/null
+++ b/claude.sh
@@ -0,0 +1,77 @@
+#!/bin/bash
+set -e
+
+# ---
+# Claude - Agent Command-Line Interface
+# ---
+# This script provides a set of commands to streamline agent development and
+# management. It's a single entry point for various SDK and agent-related
+# tasks.
+#
+# Usage: ./claude.sh [COMMAND]
+#
+# Commands:
+# install-sdk Install and build the local agent SDKs.
+# help Show this help message.
+# ---
+
+# --- Configuration ---
+# Root directory of the project
+ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+
+# --- Helper Functions ---
+function print_header() {
+ echo "--- $1 ---"
+}
+
+function print_success() {
+ echo "✅ Success: $1"
+}
+
+# --- Commands ---
+
+# Install and build the local agent SDKs
+function install_sdk() {
+ print_header "Installing Agent SDK"
+
+ # Navigate to the root of the project
+ cd "$ROOT_DIR"
+
+ # Run the npm script to install and build the SDK
+ npm run install:sdk
+
+ print_success "Agent SDK installed and built."
+}
+
+# Show the help message
+function help() {
+ # Extract the help text from the script's header comments
+ sed -n '/^# ---$/,/^# ---$/p' "$0" | sed 's/^# //g' | sed '1d;$d'
+}
+
+# --- Main Command Router ---
+function main() {
+ # Check if a command was provided
+ if [ -z "$1" ]; then
+ help
+ exit 1
+ fi
+
+ # Route to the appropriate command
+ case "$1" in
+ install-sdk)
+ install_sdk
+ ;;
+ help)
+ help
+ ;;
+ *)
+ echo "Error: Unknown command '$1'"
+ help
+ exit 1
+ ;;
+ esac
+}
+
+# --- Script Entry Point ---
+main "$@"
diff --git a/community.css b/community.css
new file mode 100644
index 000000000..687ca8fda
--- /dev/null
+++ b/community.css
@@ -0,0 +1,46 @@
+.community-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
+ gap: 2rem;
+ padding: 2rem;
+ max-width: 1280px;
+ margin: 0 auto;
+}
+
+.community-card {
+ background: rgba(255, 255, 255, 0.05);
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ border-radius: 12px;
+ padding: 2rem;
+ text-align: center;
+ transition: all 0.3s ease;
+}
+
+.community-card:hover {
+ transform: translateY(-5px);
+ background: rgba(255, 255, 255, 0.1);
+}
+
+.community-card h2 {
+ font-size: 1.5rem;
+ margin-bottom: 1rem;
+ color: #fff;
+}
+
+.community-card p {
+ color: rgba(255, 255, 255, 0.7);
+ margin-bottom: 1.5rem;
+}
+
+.community-card a {
+ color: #fff;
+ text-decoration: none;
+ background: #007bff;
+ padding: 0.75rem 1.5rem;
+ border-radius: 8px;
+ transition: background 0.3s ease;
+}
+
+.community-card a:hover {
+ background: #0056b3;
+}
diff --git a/community.html b/community.html
new file mode 100644
index 000000000..dc940307a
--- /dev/null
+++ b/community.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+ <title>three.ws — Community</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <link rel="stylesheet" href="/style.css" />
+ <link rel="stylesheet" href="/features.css" />
+ <link rel="stylesheet" href="/community.css" />
+ </head>
+ <body class="features-page">
+ <div class="page-background">
+ <div class="page-background-grid"></div>
+ <div class="page-background-mesh"></div>
+ </div>
+
+ <main class="features-main">
+ <section class="hero">
+ <div class="hero-content scroll-reveal">
+ <h1 class="hero-title">Join the <em>Community</em></h1>
+ <p class="hero-subtitle">
+ Connect with other creators, share your work, and get help from the community.
+ </p>
+ </div>
+ </section>
+ </main>
+ </body>
+</html>
diff --git a/create.html b/create.html
index bb238e499..a223761d4 100644
--- a/create.html
+++ b/create.html
@@ -599,75 +599,10 @@
<div class="dots">...</div>
</div>
<a href="#main-content" class="skip-link">Skip to main content</a>
- <header class="site-header">
- <h1>
- <a href="/" aria-label="three.ws home"
- ><img src="/three.svg" alt="" aria-hidden="true" class="nav-logo-img" />three.ws</a
- >
- </h1>
- <nav class="features-nav" aria-label="Primary">
- <ul class="nav-root" role="menubar">
- <li class="nav-item nav-has-menu" role="none">
- <button
- type="button"
- class="nav-trigger"
- aria-haspopup="true"
- aria-expanded="false"
- role="menuitem"
- >
- Build<span class="nav-caret" aria-hidden="true">▾</span>
- </button>
- <ul class="nav-menu" role="menu" aria-label="Build">
- <li role="none">
- <a href="/create" role="menuitem"
- ><span class="nav-mi-title">Create agent</span
- ><span class="nav-mi-sub">Avatar + brain wizard</span></a
- >
- </li>
- <li role="none">
- <a href="/app" role="menuitem"
- ><span class="nav-mi-title">Viewer</span
- ><span class="nav-mi-sub">Drag-and-drop GLB</span></a
- >
- </li>
- <li role="none">
- <a href="/validation" role="menuitem"
- ><span class="nav-mi-title">glTF Validator</span
- ><span class="nav-mi-sub">Khronos spec check</span></a
- >
- </li>
- </ul>
- </li>
- <li role="none"><a href="/discover" role="menuitem">Discover</a></li>
- <li class="nav-item nav-has-menu" role="none">
- <button
- type="button"
- class="nav-trigger"
- aria-haspopup="true"
- aria-expanded="false"
- role="menuitem"
- >
- Solana<span class="nav-caret" aria-hidden="true">▾</span>
- </button>
- <ul class="nav-menu" role="menu" aria-label="Solana">
- <li role="none">
- <a href="/pumpfun" role="menuitem"
- ><span class="nav-mi-title">Pump.fun stream</span
- ><span class="nav-mi-sub">Mint agent tokens</span></a
- >
- </li>
- <li role="none">
- <a href="/vanity-wallet" role="menuitem"
- ><span class="nav-mi-title">Vanity wallet</span
- ><span class="nav-mi-sub">Generate address</span></a
- >
- </li>
- </ul>
- </li>
- <li class="nav-item" role="none"><a href="/docs" role="menuitem">Docs</a></li>
- </ul>
- </nav>
+ <header>
+ <div id="nav-container"></div>
</header>
+ <script src="/nav.js"></script>
<main class="stage" id="main-content">
<div class="picker-heading">
diff --git a/examples/README.md b/examples/README.md
new file mode 100644
index 000000000..9a0d63bf1
--- /dev/null
+++ b/examples/README.md
@@ -0,0 +1,7 @@
+# Examples
+
+This directory contains examples of how to use the 3D-Agent application and SDKs.
+
+## Overview
+
+...
diff --git a/home.html b/home.html
index 2db414aed..16116f968 100644
--- a/home.html
+++ b/home.html
@@ -65,144 +65,9 @@
>three.ws</a
>
</h1>
- <nav class="home-nav" aria-label="Primary">
- <ul class="nav-root" role="menubar">
- <li class="nav-item nav-has-menu" role="none">
- <button
- type="button"
- class="nav-trigger"
- aria-haspopup="true"
- aria-expanded="false"
- role="menuitem"
- >
- Build<span class="nav-caret" aria-hidden="true">▾</span>
- </button>
- <ul class="nav-menu" role="menu" aria-label="Build">
- <li role="none">
- <a href="/create" role="menuitem"
- ><span class="nav-mi-title">Create agent</span
- ><span class="nav-mi-sub">Avatar + brain wizard</span></a
- >
- </li>
- <li role="none">
- <a href="/app" role="menuitem"
- ><span class="nav-mi-title">Viewer</span
- ><span class="nav-mi-sub">Drag-and-drop GLB</span></a
- >
- </li>
- <li role="none">
- <a href="/validation" role="menuitem"
- ><span class="nav-mi-title">glTF Validator</span
- ><span class="nav-mi-sub">Khronos spec check</span></a
- >
- </li>
- </ul>
- </li>
- <li role="none"><a href="/discover" role="menuitem">Discover</a></li>
- <li class="nav-item nav-has-menu" role="none">
- <button
- type="button"
- class="nav-trigger"
- aria-haspopup="true"
- aria-expanded="false"
- role="menuitem"
- >
- Solana<span class="nav-caret" aria-hidden="true">▾</span>
- </button>
- <ul class="nav-menu" role="menu" aria-label="Solana">
- <li role="none">
- <a href="/pumpfun" role="menuitem"
- ><span class="nav-mi-title">Pump.fun stream</span
- ><span class="nav-mi-sub">Mint agent tokens</span></a
- >
- </li>
- <li role="none">
- <a href="/vanity-wallet" role="menuitem"
- ><span class="nav-mi-title">Vanity wallet</span
- ><span class="nav-mi-sub">Grind a Solana address</span></a
- >
- </li>
- <li role="none">
- <a href="/strategy-lab" role="menuitem"
- ><span class="nav-mi-title">Strategy Lab</span
- ><span class="nav-mi-sub">DCA + subscriptions</span></a
- >
- </li>
- <li role="none">
- <a href="/pump-live.html" role="menuitem"
- ><span class="nav-mi-title">Live launches</span
- ><span class="nav-mi-sub">Real-time mint feed</span></a
- >
- </li>
- <li role="none">
- <a href="/pump-dashboard.html" role="menuitem"
- ><span class="nav-mi-title">Pump Dashboard</span
- ><span class="nav-mi-sub">Watches · scanner · quotes</span></a
- >
- </li>
- <li role="none">
- <a href="/docs#solana" role="menuitem"
- ><span class="nav-mi-title">Solana SDK</span
- ><span class="nav-mi-sub">Attestations + agent-kit</span></a
- >
- </li>
- </ul>
- </li>
- <li class="nav-item nav-has-menu" role="none">
- <button
- type="button"
- class="nav-trigger"
- aria-haspopup="true"
- aria-expanded="false"
- role="menuitem"
- >
- Embed<span class="nav-caret" aria-hidden="true">▾</span>
- </button>
- <ul class="nav-menu" role="menu" aria-label="Embed">
- <li role="none">
- <a href="/studio" role="menuitem"
- ><span class="nav-mi-title">Widget Studio</span
- ><span class="nav-mi-sub">Pick avatar → copy snippet</span></a
- >
- </li>
- <li role="none">
- <a href="/artifact" role="menuitem"
- ><span class="nav-mi-title">Artifact viewer</span
- ><span class="nav-mi-sub">Claude artifact bundle</span></a
- >
- </li>
- <li role="none">
- <a href="/docs#embedding" role="menuitem"
- ><span class="nav-mi-title">Embed docs</span
- ><span class="nav-mi-sub">iframe + oEmbed</span></a
- >
- </li>
- <li role="none">
- <a href="/docs#web-component" role="menuitem"
- ><span class="nav-mi-title">&lt;agent-3d&gt;</span
- ><span class="nav-mi-sub">Web component reference</span></a
- >
- </li>
- </ul>
- </li>
- <li class="nav-item" role="none"><a href="/marketplace.html" role="menuitem">Marketplace</a></li>
- <li class="nav-item" role="none"><a href="/chat" role="menuitem">Chat</a></li>
- <li class="nav-item" role="none">
- <a href="/features" role="menuitem">Features</a>
- </li>
- <li class="nav-item" role="none"><a href="/tutorials.html" role="menuitem">Tutorials</a></li>
- <li class="nav-item" id="home-nav-my-agents-li" role="none" hidden>
- <a href="/my-agents" id="home-nav-my-agents" role="menuitem">My Agents</a>
- </li>
- <li class="nav-item" id="home-nav-user-li" role="none" hidden>
- <a href="/dashboard" id="home-nav-user" class="nav-user" role="menuitem"></a>
- </li>
- <li class="nav-item" role="none">
- <a href="/login" class="nav-cta" id="home-nav-cta" role="menuitem"
- >Get started</a
- >
- </li>
- </ul>
+ <div id="nav-container"></div>
+ </header>
+ <script src="/nav.js"></script>
</nav>
</header>
diff --git a/index.html b/index.html
index d400c28ea..e7ed3e68b 100644
--- a/index.html
+++ b/index.html
@@ -767,67 +767,9 @@
><img class="wordmark-logo" src="/three.svg" alt="" aria-hidden="true" /><span class="wordmark-dot" aria-hidden="true"></span>three.ws</a
>
</h1>
- <nav class="features-nav" aria-label="Primary">
- <ul class="nav-root" role="menubar">
- <li class="nav-item nav-has-menu" role="none">
- <button
- type="button"
- class="nav-trigger"
- aria-haspopup="true"
- aria-expanded="false"
- role="menuitem"
- >
- Build<span class="nav-caret" aria-hidden="true">▾</span>
- </button>
- <ul class="nav-menu" role="menu" aria-label="Build">
- <li role="none">
- <a href="/create" role="menuitem"
- ><span class="nav-mi-title">Create agent</span
- ><span class="nav-mi-sub">Avatar + brain wizard</span></a
- >
- </li>
- <li role="none">
- <a href="/app" role="menuitem"
- ><span class="nav-mi-title">Viewer</span
- ><span class="nav-mi-sub">Drag-and-drop GLB</span></a
- >
- </li>
- <li role="none">
- <a href="/validation" role="menuitem"
- ><span class="nav-mi-title">glTF Validator</span
- ><span class="nav-mi-sub">Khronos spec check</span></a
- >
- </li>
- </ul>
- </li>
- <li role="none"><a href="/discover" role="menuitem">Discover</a></li>
- <li class="nav-item nav-has-menu" role="none">
- <button
- type="button"
- class="nav-trigger"
- aria-haspopup="true"
- aria-expanded="false"
- role="menuitem"
- >
- Solana<span class="nav-caret" aria-hidden="true">▾</span>
- </button>
- <ul class="nav-menu" role="menu" aria-label="Solana">
- <li role="none">
- <a href="/pumpfun" role="menuitem"
- ><span class="nav-mi-title">Pump.fun stream</span
- ><span class="nav-mi-sub">Mint agent tokens</span></a
- >
- </li>
- <li role="none">
- <a href="/vanity-wallet" role="menuitem"
- ><span class="nav-mi-title">Vanity wallet</span
- ><span class="nav-mi-sub">Generate address</span></a
- >
- </li>
- </ul>
- </li>
- </ul>
- </nav>
+ <div id="nav-container"></div>
+ </header>
+ <script src="/nav.js"></script>
</header>
<main id="main-content" class="features-main">
diff --git a/package.json b/package.json
index 9c916f17e..436d44419 100644
--- a/package.json
+++ b/package.json
@@ -22,7 +22,11 @@
"drag-and-drop",
"3d-agent"
],
- "workspaces": [],
+ "workspaces": [
+ "agent-payments-sdk",
+ "character-studio",
+ "chat"
+ ],
"main": "src/app.js",
"browserslist": [
">1%",
@@ -69,7 +73,8 @@
"pump:smoke": "node scripts/pumpfun-lifecycle-smoke.js",
"pump:refresh-idls": "node scripts/refresh-pump-idls.mjs",
"seed:skills": "node scripts/seed-skills.js",
- "install:sdk": "npm install --prefix agent-payments-sdk && npm run build --prefix agent-payments-sdk && npm install ./agent-payments-sdk"
+ "install:sdk": "npm install --prefix agent-payments-sdk && npm run build --prefix agent-payments-sdk && npm install ./agent-payments-sdk",
+ "claude": "./claude.sh"
},
"dependencies": {
"@avaturn/sdk": "^1.1.4",
@@ -117,7 +122,9 @@
"vhtml": "^2.2.0",
"viem": "^2.18.0",
"ws": "^8.20.0",
- "zod": "^3.23.8"
+ "zod": "^3.23.8",
+ "vite": "^5.3.6"
+ },
},
"devDependencies": {
"ajv": "^8.17.1",
@@ -126,7 +133,6 @@
"playwright": "^1.45.1",
"prettier": "^3.2.5",
"sharp": "^0.34.5",
- "vite": "^5.3.6",
"vite-plugin-pwa": "^1.2.0",
"vitest": "^1.6.0",
"workbox-build": "^7.4.0",
diff --git a/playground.css b/playground.css
new file mode 100644
index 000000000..4d8d641bb
--- /dev/null
+++ b/playground.css
@@ -0,0 +1,81 @@
+.playground-container {
+ display: flex;
+ gap: 2rem;
+ padding: 2rem;
+}
+
+.playground-controls {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ gap: 1.5rem;
+}
+
+.playground-controls .control-group {
+ display: flex;
+ flex-direction: column;
+ gap: 0.5rem;
+}
+
+.playground-controls label {
+ font-weight: 500;
+}
+
+.playground-controls input,
+.playground-controls select {
+ padding: 0.5rem;
+ border-radius: 4px;
+ border: 1px solid #333;
+ background-color: #111;
+ color: #eee;
+}
+
+.playground-viewer-container {
+ flex: 2;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ min-height: 400px;
+}
+
+#playground-viewer {
+ width: 100%;
+ height: 100%;
+ min-width: 300px;
+ min-height: 300px;
+}
+
+#playground-viewer model-viewer {
+ width: 100%;
+ height: 100%;
+ border-radius: 8px;
+ border: 1px solid #333;
+}
+
+pre {
+ background: #1a1a1a;
+ padding: 1rem;
+ border-radius: 8px;
+ overflow-x: auto;
+ white-space: pre-wrap;
+ word-break: break-all;
+}
+
+code {
+ font-family: 'SF Mono', 'Fira Code', ui-monospace, monospace;
+}
+
+button {
+ padding: 0.75rem 1.5rem;
+ border-radius: 4px;
+ border: 1px solid var(--accent);
+ background-color: var(--accent);
+ color: white;
+ cursor: pointer;
+ font-weight: 600;
+ transition: background-color 0.2s;
+}
+
+button:hover {
+ background-color: #7a4be0;
+}
diff --git a/playground.html b/playground.html
index 3de4099ae..272f98aef 100644
--- a/playground.html
+++ b/playground.html
@@ -64,7 +64,6 @@
}
</style>
</head>
-<body>
<header class="agent-page-header" style="justify-content: space-between">
<div style="display:inline-flex;align-items:center">
<a href="/marketplace.html?tab=mine" aria-label="Back to three.ws home">
@@ -102,6 +101,19 @@
<input type="text" id="avatar-name" placeholder="Enter a name for your avatar">
<button id="save-avatar">Save</button>
<button id="embed-avatar">Embed</button>
+ <button id="reset-avatar">Reset to Default</button>
+ </div>
+ <div id="embed-modal" class="modal">
+ <div class="modal-content">
+ <span class="close-button">&times;</span>
+ <h2>Embed your avatar</h2>
+ <p>Copy the code below to embed your avatar on your website.</p>
+ <textarea id="embed-code" readonly></textarea>
+ <button id="copy-embed-code">Copy</button>
+ </div>
+ </div>
+ <div id="loading-indicator" class="loading-indicator">
+ <div class="spinner"></div>
</div>
<style>
.upload-container {
@@ -130,7 +142,7 @@
border-radius: 0.5rem;
border: 1px solid #ccc;
}
- #save-avatar, #embed-avatar {
+ #save-avatar, #embed-avatar, #reset-avatar, #copy-embed-code {
background: #ffd700;
color: #000;
padding: 0.5rem 1rem;
@@ -138,47 +150,179 @@
cursor: pointer;
border: none;
}
+ .modal {
+ display: none;
+ position: fixed;
+ z-index: 1;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ overflow: auto;
+ background-color: rgba(0,0,0,0.4);
+ }
+ .modal-content {
+ background-color: #fefefe;
+ margin: 15% auto;
+ padding: 20px;
+ border: 1px solid #888;
+ width: 80%;
+ max-width: 500px;
+ border-radius: 0.5rem;
+ }
+ .close-button {
+ color: #aaa;
+ float: right;
+ font-size: 28px;
+ font-weight: bold;
+ }
+ .close-button:hover,
+ .close-button:focus {
+ color: black;
+ text-decoration: none;
+ cursor: pointer;
+ }
+ #embed-code {
+ width: 100%;
+ height: 100px;
+ margin-top: 1rem;
+ border-radius: 0.5rem;
+ }
+ #copy-embed-code {
+ margin-top: 1rem;
+ }
+ .loading-indicator {
+ display: none;
+ position: fixed;
+ z-index: 2;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ background-color: rgba(0,0,0,0.4);
+ }
+ .spinner {
+ border: 16px solid #f3f3f3;
+ border-top: 16px solid #3498db;
+ border-radius: 50%;
+ width: 120px;
+ height: 120px;
+ animation: spin 2s linear infinite;
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ margin-top: -60px;
+ margin-left: -60px;
+ }
+ @keyframes spin {
+ 0% { transform: rotate(0deg); }
+ 100% { transform: rotate(360deg); }
+ }
</style>
<script>
- const viewer = document.getElementById('viewer');
- const upload = document.getElementById('avatar-upload');
- const saveButton = document.getElementById('save-avatar');
- const embedButton = document.getElementById('embed-avatar');
- const avatarName = document.getElementById('avatar-name');
- upload.addEventListener('change', (event) => {
- const file = event.target.files[0];
- if (file) {
- const url = URL.createObjectURL(file);
- viewer.src = url;
- }
- });
- saveButton.addEventListener('click', () => {
- const name = avatarName.value;
- const file = upload.files[0];
- if (name && file) {
- const reader = new FileReader();
- reader.onload = (event) => {
- const avatar = {
- name,
- file: event.target.result
+ document.addEventListener('DOMContentLoaded', () => {
+ const viewer = document.getElementById('viewer');
+ const upload = document.getElementById('avatar-upload');
+ const saveButton = document.getElementById('save-avatar');
+ const embedButton = document.getElementById('embed-avatar');
+ const resetButton = document.getElementById('reset-avatar');
+ const avatarName = document.getElementById('avatar-name');
+ const modal = document.getElementById('embed-modal');
+ const closeButton = document.querySelector('.close-button');
+ const copyEmbedCodeButton = document.getElementById('copy-embed-code');
+ const loadingIndicator = document.getElementById('loading-indicator');
+
+ const defaultAvatar = {
+ name: 'Default Avatar',
+ file: '/assets/default-avatar.glb'
+ };
+
+ const showLoading = () => loadingIndicator.style.display = 'block';
+ const hideLoading = () => loadingIndicator.style.display = 'none';
+
+ const loadAvatar = (avatar) => {
+ showLoading();
+ avatarName.value = avatar.name;
+ viewer.src = avatar.file;
+ viewer.addEventListener('load', () => {
+ hideLoading();
+ }, { once: true });
+ };
+
+ const handleFileUpload = (event) => {
+ const file = event.target.files[0];
+ if (file) {
+ if (file.name.endsWith('.glb')) {
+ const url = URL.createObjectURL(file);
+ loadAvatar({ name: file.name, file: url });
+ } else {
+ alert('Please upload a .glb file.');
+ }
+ }
+ };
+
+ const saveAvatar = () => {
+ const name = avatarName.value;
+ const file = upload.files[0];
+ if (name && file) {
+ const reader = new FileReader();
+ reader.onload = (event) => {
+ const avatar = {
+ name,
+ file: event.target.result
+ };
+ localStorage.setItem('avatar', JSON.stringify(avatar));
+ alert('Avatar saved!');
};
- localStorage.setItem('avatar', JSON.stringify(avatar));
- alert('Avatar saved!');
- };
- reader.readAsDataURL(file);
- } else {
- alert('Please enter a name and upload an avatar.');
- }
- });
- embedButton.addEventListener('click', () => {
- // TODO: Implement embed functionality
- alert('Embed code copied to clipboard!');
+ reader.readAsDataURL(file);
+ } else {
+ alert('Please enter a name and upload an avatar.');
+ }
+ };
+
+ const openEmbedModal = () => {
+ const savedAvatar = JSON.parse(localStorage.getItem('avatar'));
+ if (savedAvatar) {
+ const embedCode = `<iframe src="${window.location.origin}/a-embed.html?avatar=${encodeURIComponent(savedAvatar.file)}" width="500" height="500" frameborder="0"></iframe>`;
+ const embedCodeTextarea = document.getElementById('embed-code');
+ embedCodeTextarea.value = embedCode;
+ modal.style.display = 'block';
+ } else {
+ alert('Please save an avatar first.');
+ }
+ };
+
+ const closeModal = () => {
+ modal.style.display = 'none';
+ };
+
+ const copyEmbedCode = () => {
+ const embedCodeTextarea = document.getElementById('embed-code');
+ embedCodeTextarea.select();
+ document.execCommand('copy');
+ alert('Embed code copied to clipboard!');
+ };
+
+ const resetToDefault = () => {
+ localStorage.removeItem('avatar');
+ loadAvatar(defaultAvatar);
+ };
+
+ upload.addEventListener('change', handleFileUpload);
+ saveButton.addEventListener('click', saveAvatar);
+ embedButton.addEventListener('click', openEmbedModal);
+ resetButton.addEventListener('click', resetToDefault);
+ closeButton.addEventListener('click', closeModal);
+ copyEmbedCodeButton.addEventListener('click', copyEmbedCode);
+ window.addEventListener('click', (event) => {
+ if (event.target == modal) {
+ closeModal();
+ }
+ });
+
+ const savedAvatar = JSON.parse(localStorage.getItem('avatar'));
+ loadAvatar(savedAvatar || defaultAvatar);
});
- const savedAvatar = JSON.parse(localStorage.getItem('avatar'));
- if (savedAvatar) {
- avatarName.value = savedAvatar.name;
- viewer.src = savedAvatar.file;
- }
</script>
</body>
</html>
diff --git a/public/docs-widgets.html b/public/docs-widgets.html
index 14dbaa569..62df099b2 100644
--- a/public/docs-widgets.html
+++ b/public/docs-widgets.html
@@ -131,72 +131,10 @@
</style>
</head>
<body class="gallery-body">
- <header class="gallery-header">
- <h1>
- <a href="/"><img class="wordmark-logo docs-logo-mark" src="/three.svg" alt="" aria-hidden="true" /><span class="wordmark-dot" aria-hidden="true"></span>three.ws</a>
- </h1>
- <nav class="features-nav" aria-label="Primary">
- <ul class="nav-root" role="menubar">
- <li class="nav-item nav-has-menu" role="none">
- <button
- type="button"
- class="nav-trigger"
- aria-haspopup="true"
- aria-expanded="false"
- role="menuitem"
- >
- Build<span class="nav-caret" aria-hidden="true">▾</span>
- </button>
- <ul class="nav-menu" role="menu" aria-label="Build">
- <li role="none">
- <a href="/create" role="menuitem"
- ><span class="nav-mi-title">Create agent</span
- ><span class="nav-mi-sub">Avatar + brain wizard</span></a
- >
- </li>
- <li role="none">
- <a href="/app" role="menuitem"
- ><span class="nav-mi-title">Viewer</span
- ><span class="nav-mi-sub">Drag-and-drop GLB</span></a
- >
- </li>
- <li role="none">
- <a href="/validation" role="menuitem"
- ><span class="nav-mi-title">glTF Validator</span
- ><span class="nav-mi-sub">Khronos spec check</span></a
- >
- </li>
- </ul>
- </li>
- <li role="none"><a href="/discover" role="menuitem">Discover</a></li>
- <li class="nav-item nav-has-menu" role="none">
- <button
- type="button"
- class="nav-trigger"
- aria-haspopup="true"
- aria-expanded="false"
- role="menuitem"
- >
- Solana<span class="nav-caret" aria-hidden="true">▾</span>
- </button>
- <ul class="nav-menu" role="menu" aria-label="Solana">
- <li role="none">
- <a href="/pumpfun" role="menuitem"
- ><span class="nav-mi-title">Pump.fun stream</span
- ><span class="nav-mi-sub">Mint agent tokens</span></a
- >
- </li>
- <li role="none">
- <a href="/vanity-wallet" role="menuitem"
- ><span class="nav-mi-title">Vanity wallet</span
- ><span class="nav-mi-sub">Generate address</span></a
- >
- </li>
- </ul>
- </li>
- </ul>
- </nav>
+ <header>
+ <div id="nav-container"></div>
</header>
+ <script src="/nav.js"></script>
<main class="docs-main">
<h1>Widgets</h1>
diff --git a/public/features/index.html b/public/features/index.html
index a28fb6a33..5b83a5db1 100644
--- a/public/features/index.html
+++ b/public/features/index.html
@@ -38,80 +38,9 @@
<a href="#deploy" class="skip-link">Skip to deploy</a>
<header>
- <h1>
- <a href="/"><img src="/three.svg" alt="three.ws logo" class="wordmark-logo" /></a>
- </h1>
- <nav class="features-nav" aria-label="Primary">
- <ul class="nav-root" role="menubar">
- <li class="nav-item nav-has-menu" role="none">
- <button
- type="button"
- class="nav-trigger"
- aria-haspopup="true"
- aria-expanded="false"
- role="menuitem"
- >
- Build<span class="nav-caret" aria-hidden="true">▾</span>
- </button>
- <ul class="nav-menu" role="menu" aria-label="Build">
- <li role="none">
- <a href="/create" role="menuitem"
- ><span class="nav-mi-title">Create agent</span
- ><span class="nav-mi-sub">Avatar + brain wizard</span></a
- >
- </li>
- <li role="none">
- <a href="/app" role="menuitem"
- ><span class="nav-mi-title">Viewer</span
- ><span class="nav-mi-sub">Drag-and-drop GLB</span></a
- >
- </li>
- <li role="none">
- <a href="/validation" role="menuitem"
- ><span class="nav-mi-title">glTF Validator</span
- ><span class="nav-mi-sub">Khronos spec check</span></a
- >
- </li>
- </ul>
- </li>
- <li role="none"><a href="/discover" role="menuitem">Discover</a></li>
- <li class="nav-item nav-has-menu" role="none">
- <button
- type="button"
- class="nav-trigger"
- aria-haspopup="true"
- aria-expanded="false"
- role="menuitem"
- >
- Solana<span class="nav-caret" aria-hidden="true">▾</span>
- </button>
- <ul class="nav-menu" role="menu" aria-label="Solana">
- <li role="none">
- <a href="/pumpfun" role="menuitem"
- ><span class="nav-mi-title">Pump.fun stream</span
- ><span class="nav-mi-sub">Mint agent tokens</span></a
- >
- </li>
- <li role="none">
- <a href="/vanity-wallet" role="menuitem"
- ><span class="nav-mi-title">Vanity wallet</span
- ><span class="nav-mi-sub">Generate address</span></a
- >
- </li>
- </ul>
- </li>
- <li class="nav-item" role="none"><a href="/docs" role="menuitem">Docs</a></li>
- <li class="nav-item" role="none">
- <a href="/features" role="menuitem" class="active">Features</a>
- </li>
- <li class="nav-item" role="none"><a href="/tutorials.html" role="menuitem">Tutorials</a></li>
- <li class="nav-item" id="home-nav-my-agents-li" role="none" hidden>
- <a href="/my-agents" id="home-nav-my-agents" role="menuitem">My Agents</a>
- </li>
- <li class="nav-item" role="none"><a href="/login.html" role="menuitem">Sign in</a></li>
- </ul>
- </nav>
+ <div id="nav-container"></div>
</header>
+ <script src="/nav.js"></script>
<main class="parallax" data-role="parallax-root">
<!-- ─── ACT 1 — Live 3D, in your browser ─────────────────────────── -->
diff --git a/public/widget-demo.html b/public/widget-demo.html
index 1f0d264e6..06d2b7308 100644
--- a/public/widget-demo.html
+++ b/public/widget-demo.html
@@ -105,6 +105,30 @@
</ul>
</div>
+ <div class="instructions">
+ <h2>Dynamic Loading</h2>
+ <p>The widget script automatically detects new widgets added to the page. Click the button to add another agent.</p>
+ <button id="addWidgetBtn">Add Another Widget</button>
+ <div id="dynamic-container" style="margin-top: 1rem;"></div>
+ </div>
+
+ <script>
+ document.getElementById('addWidgetBtn').addEventListener('click', () => {
+ const container = document.getElementById('dynamic-container');
+ const newWidget = document.createElement('div');
+ newWidget.className = 'widget-card';
+ newWidget.innerHTML = `
+ <h2>Dynamically Added</h2>
+ <div class="widget-container">
+ <div class="threews-widget" data-agent-id="041cb44a-3c58-4d56-b083-d5234563456a" data-background="light"></div>
+ </div>
+ `;
+ // To prevent adding too many, let's just replace the content
+ container.innerHTML = '';
+ container.appendChild(newWidget);
+ });
+ </script>
+
<script src="/dist/widget.js" defer></script>
</body>
diff --git a/public/widgets-gallery/index.html b/public/widgets-gallery/index.html
index 4d26024f5..5a9eb72bc 100644
--- a/public/widgets-gallery/index.html
+++ b/public/widgets-gallery/index.html
@@ -38,67 +38,9 @@
<h1>
<a href="/"><img src="/three.svg" alt="three.ws" class="wordmark-logo" /></a>
</h1>
- <nav class="features-nav" aria-label="Primary">
- <ul class="nav-root" role="menubar">
- <li class="nav-item nav-has-menu" role="none">
- <button
- type="button"
- class="nav-trigger"
- aria-haspopup="true"
- aria-expanded="false"
- role="menuitem"
- >
- Build<span class="nav-caret" aria-hidden="true">▾</span>
- </button>
- <ul class="nav-menu" role="menu" aria-label="Build">
- <li role="none">
- <a href="/create" role="menuitem"
- ><span class="nav-mi-title">Create agent</span
- ><span class="nav-mi-sub">Avatar + brain wizard</span></a
- >
- </li>
- <li role="none">
- <a href="/app" role="menuitem"
- ><span class="nav-mi-title">Viewer</span
- ><span class="nav-mi-sub">Drag-and-drop GLB</span></a
- >
- </li>
- <li role="none">
- <a href="/validation" role="menuitem"
- ><span class="nav-mi-title">glTF Validator</span
- ><span class="nav-mi-sub">Khronos spec check</span></a
- >
- </li>
- </ul>
- </li>
- <li role="none"><a href="/discover" role="menuitem">Discover</a></li>
- <li class="nav-item nav-has-menu" role="none">
- <button
- type="button"
- class="nav-trigger"
- aria-haspopup="true"
- aria-expanded="false"
- role="menuitem"
- >
- Solana<span class="nav-caret" aria-hidden="true">▾</span>
- </button>
- <ul class="nav-menu" role="menu" aria-label="Solana">
- <li role="none">
- <a href="/pumpfun" role="menuitem"
- ><span class="nav-mi-title">Pump.fun stream</span
- ><span class="nav-mi-sub">Mint agent tokens</span></a
- >
- </li>
- <li role="none">
- <a href="/vanity-wallet" role="menuitem"
- ><span class="nav-mi-title">Vanity wallet</span
- ><span class="nav-mi-sub">Generate address</span></a
- >
- </li>
- </ul>
- </li>
- </ul>
- </nav>
+ <div id="nav-container"></div>
+ </header>
+ <script src="/nav.js"></script>
</header>
<main class="gallery-main" id="gallery-main">
diff --git a/pumpfun-counter.html b/pumpfun-counter.html
index d3494c35c..b57e0586f 100644
--- a/pumpfun-counter.html
+++ b/pumpfun-counter.html
@@ -26,54 +26,15 @@
<body>
<div id="counter">0</div>
<script type="module">
+ import pumpFunClient from '../src/pumpfun-client.js';
+
let count = 0;
const counterElement = document.getElementById('counter');
- const RPC_ENDPOINTS = [
- { url: 'wss://pumpportal.fun/api/data', protocol: 'pumpportal', label: 'PumpPortal' },
- { url: 'wss://pump-fun-websocket-production.up.railway.app/ws', protocol: 'relay', label: 'Relay Server' },
- ];
- let rpcIndex = 0;
- let ws = null;
-
- function connect() {
- const ep = RPC_ENDPOINTS[rpcIndex % RPC_ENDPOINTS.length];
- rpcIndex++;
- ws = new WebSocket(ep.url);
-
- ws.onopen = () => {
- if (ep.protocol === 'pumpportal') {
- ws.send(JSON.stringify({ method: 'subscribeNewToken' }));
- }
- };
-
- ws.onmessage = (evt) => {
- let msg;
- try { msg = JSON.parse(evt.data); } catch { return; }
-
- if (ep.protocol === 'relay') {
- if (msg.type === 'token-launch' || msg.mint) {
- count++;
- counterElement.innerText = count;
- }
- return;
- }
-
- if (ep.protocol === 'pumpportal') {
- if (msg && msg.mint) {
- count++;
- counterElement.innerText = count;
- }
- return;
- }
- };
-
- ws.onclose = () => {
- setTimeout(connect, 1000);
- };
- }
-
- connect();
+ pumpFunClient.addEventListener('token', () => {
+ count++;
+ counterElement.innerText = count;
+ });
</script>
</body>
</html>
diff --git a/pumpfun-widget.html b/pumpfun-widget.html
index 31de33e54..54d794ac6 100644
--- a/pumpfun-widget.html
+++ b/pumpfun-widget.html
@@ -56,9 +56,21 @@
body.bg-light .mcap {
color: #999;
}
+ #status {
+ position: absolute;
+ top: 8px;
+ right: 8px;
+ width: 8px;
+ height: 8px;
+ border-radius: 50%;
+ background: #444;
+ }
+ #status.connected { background: #00ff41; }
+ #status.error { background: #ff4141; }
</style>
</head>
<body>
+ <div id="status"></div>
<div id="root"></div>
<script type="module">
const params = new URL(location.href).searchParams;
@@ -73,18 +85,23 @@
];
let rpcIndex = 0;
let ws = null;
+ let reconnectTimer = null;
function connect() {
+ if (reconnectTimer) clearTimeout(reconnectTimer);
const ep = RPC_ENDPOINTS[rpcIndex % RPC_ENDPOINTS.length];
rpcIndex++;
ws = new WebSocket(ep.url);
+ const statusEl = document.getElementById('status');
ws.onopen = () => {
if (ep.protocol === 'pumpportal') {
ws.send(JSON.stringify({ method: 'subscribeNewToken' }));
}
+ statusEl.className = 'connected';
};
+
ws.onmessage = (evt) => {
let msg;
try { msg = JSON.parse(evt.data); } catch { return; }
@@ -118,21 +135,54 @@
symbol: msg.symbol || null,
marketCapSol: mcap,
imageUrl: null, // PumpPortal does not provide image directly
+ metadataUri: msg.uri || null,
};
renderEntry(info);
+ if (info.metadataUri) fetchMetadata(info);
}
return;
}
};
+ ws.onerror = () => {
+ document.getElementById('status').className = 'error';
+ }
+
ws.onclose = () => {
- setTimeout(connect, 1000);
+ document.getElementById('status').className = '';
+ reconnectTimer = setTimeout(connect, 3000);
};
}
+ async function fetchMetadata(info) {
+ try {
+ let url = info.metadataUri;
+ if (!url) return;
+ if (url.startsWith('ipfs://')) {
+ url = 'https://cloudflare-ipfs.com/ipfs/' + url.slice(7);
+ }
+ const resp = await fetch(url, { signal: AbortSignal.timeout(5000) });
+ if (!resp.ok) return;
+ const meta = await resp.json();
+ if (meta.image) {
+ let imgSrc = meta.image;
+ if (imgSrc.startsWith('ipfs://')) {
+ imgSrc = 'https://cloudflare-ipfs.com/ipfs/' + imgSrc.slice(7);
+ }
+ const imgEl = document.querySelector(`#entry-${info.mint} .token-img`);
+ if (imgEl) {
+ imgEl.src = imgSrc;
+ imgEl.style.display = 'block';
+ }
+ }
+ } catch {}
+ }
+
+
function renderEntry(info) {
const div = document.createElement('div');
div.className = 'entry';
+ div.id = `entry-${info.mint}`;
const displayName = info.name || 'Unknown';
const displaySymbol = info.symbol ? '$' + info.symbol : '';
diff --git a/scripts/README.md b/scripts/README.md
new file mode 100644
index 000000000..ce1f69340
--- /dev/null
+++ b/scripts/README.md
@@ -0,0 +1,7 @@
+# Scripts
+
+This directory contains various scripts for the 3D-Agent application.
+
+## Usage
+
+...
diff --git a/services/README.md b/services/README.md
new file mode 100644
index 000000000..8c3e5c8f1
--- /dev/null
+++ b/services/README.md
@@ -0,0 +1,7 @@
+# Services
+
+This directory contains services used by the 3D-Agent application.
+
+## Overview
+
+...
diff --git a/solana-agent-sdk/README.md b/solana-agent-sdk/README.md
new file mode 100644
index 000000000..54e4f6bf2
--- /dev/null
+++ b/solana-agent-sdk/README.md
@@ -0,0 +1,15 @@
+# Solana Agent SDK
+
+This directory contains the Solana Agent SDK.
+
+## Overview
+
+This SDK provides tools and libraries for interacting with the Solana blockchain.
+
+## Installation
+
+`npm install`
+
+## Usage
+
+...
diff --git a/specs/README.md b/specs/README.md
new file mode 100644
index 000000000..5f4687e7b
--- /dev/null
+++ b/specs/README.md
@@ -0,0 +1,7 @@
+# Specifications
+
+This directory contains specifications for the 3D-Agent application.
+
+## Overview
+
+...
diff --git a/src/README.md b/src/README.md
new file mode 100644
index 000000000..8a720273b
--- /dev/null
+++ b/src/README.md
@@ -0,0 +1,8 @@
+# Source Code
+
+This directory contains the main source code for the 3D-Agent application.
+
+## Structure
+
+The source code is organized into the following directories:
+...
diff --git a/src/agent-detail.css b/src/agent-detail.css
index 91b921861..368513358 100644
--- a/src/agent-detail.css
+++ b/src/agent-detail.css
@@ -280,3 +280,99 @@ a { color: inherit; text-decoration: none; }
height: 100%;
border: 0;
}
+
+/* Modal Styles */
+.ad-modal-overlay {
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ background: rgba(0, 0, 0, 0.7);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ z-index: 1000;
+}
+
+.hidden {
+ display: none;
+}
+
+.ad-modal {
+ background: var(--ad-card);
+ border: 1px solid var(--ad-line);
+ border-radius: 14px;
+ width: 90%;
+ max-width: 420px;
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
+}
+
+.ad-modal-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 16px 20px;
+ border-bottom: 1px solid var(--ad-line);
+}
+
+.ad-modal-header h3 {
+ margin: 0;
+ font-size: 16px;
+ font-weight: 500;
+}
+
+.ad-modal-close {
+ background: none;
+ border: none;
+ font-size: 24px;
+ color: var(--ad-muted);
+ cursor: pointer;
+ line-height: 1;
+}
+
+.ad-modal-close:hover {
+ color: var(--ad-text);
+}
+
+.ad-modal-body {
+ padding: 20px;
+}
+
+.ad-form-group {
+ margin-bottom: 16px;
+}
+
+.ad-form-group label {
+ display: block;
+ font-size: 12px;
+ color: var(--ad-muted);
+ margin-bottom: 6px;
+}
+
+.ad-input {
+ width: 100%;
+ background: var(--ad-bg-2);
+ border: 1px solid var(--ad-line);
+ color: var(--ad-text);
+ border-radius: 8px;
+ padding: 10px 12px;
+ font-family: inherit;
+ font-size: 14px;
+}
+
+.ad-input:focus {
+ outline: none;
+ border-color: var(--ad-line-2);
+}
+
+.ad-modal-footer {
+ display: flex;
+ justify-content: flex-end;
+ gap: 10px;
+ padding: 16px 20px;
+ border-top: 1px solid var(--ad-line);
+ background: var(--ad-bg-2);
+ border-bottom-left-radius: 14px;
+ border-bottom-right-radius: 14px;
+}
diff --git a/src/agent-detail.js b/src/agent-detail.js
index 636dc4be0..be6c31908 100644
--- a/src/agent-detail.js
+++ b/src/agent-detail.js
@@ -205,12 +205,23 @@ function render(agent) {
if (agent.tradeUrl && agent.tradeUrl !== '#') $('ad-trade').href = agent.tradeUrl;
else $('ad-trade').style.display = 'none';
+ document.querySelector('.ad-main').classList.remove('loading');
+}
+
+function renderNotFound(id, reason) {
+ document.title = 'Agent not found — three.ws';
const receiveBtn = document.getElementById('receive-btn');
const withdrawBtn = document.getElementById('withdraw-btn');
const swapBtn = document.getElementById('swap-btn');
const qrCodeContainer = document.getElementById('qr-code-container');
const qrCodeCanvas = document.getElementById('qr-code');
const walletAddressSpan = document.getElementById('ad-holdings-addr');
+ const modal = document.getElementById('withdraw-modal');
+ const closeModalBtn = document.getElementById('close-modal-btn');
+ const cancelWithdrawBtn = document.getElementById('cancel-withdraw-btn');
+ const confirmWithdrawBtn = document.getElementById('confirm-withdraw-btn');
+ const withdrawAmountInput = document.getElementById('withdraw-amount');
+ const recipientAddressInput = document.getElementById('recipient-address');
receiveBtn.addEventListener('click', () => {
const walletAddress = walletAddressSpan.dataset.full;
@@ -227,16 +238,30 @@ function render(agent) {
});
withdrawBtn.addEventListener('click', () => {
- const amount = prompt("Enter amount to withdraw (in SOL):");
- if (amount === null) return;
+ modal.classList.remove('hidden');
+ });
- const recipient = prompt("Enter recipient address:");
- if (recipient === null) return;
+ closeModalBtn.addEventListener('click', () => {
+ modal.classList.add('hidden');
+ });
- if (amount && recipient) {
- alert(`Withdrawal of ${amount} SOL to ${recipient} initiated. (This is a placeholder)`);
- console.log('Withdraw:', { amount, recipient });
- }
+ cancelWithdrawBtn.addEventListener('click', () => {
+ modal.classList.add('hidden');
+ });
+
+ confirmWithdrawBtn.addEventListener('click', () => {
+ const amount = withdrawAmountInput.value;
+ const recipient = recipientAddressInput.value;
+
+ if (amount && recipient) {
+ alert(`Withdrawal of ${amount} SOL to ${recipient} initiated. (This is a placeholder)`);
+ console.log('Withdraw:', { amount, recipient });
+ modal.classList.add('hidden');
+ withdrawAmountInput.value = '';
+ recipientAddressInput.value = '';
+ } else {
+ alert('Please fill out both fields.');
+ }
});
swapBtn.addEventListener('click', () => {
diff --git a/src/marketplace.js b/src/marketplace.js
index 17e7647d8..ae3cc31b9 100644
--- a/src/marketplace.js
+++ b/src/marketplace.js
@@ -175,7 +175,7 @@ function renderCard(a) {
<div class="avatar">${initial(a.name)}</div>
<div style="min-width:0;flex:1">
<div class="title">${escapeHtml(a.name || 'Untitled')}</div>
- <div class="author">${escapeHtml(a.category || 'general')}</div>
+ <div class="author">${escapeHtml(a.author_name || 'Anonymous')}</div>
</div>
</div>
<div class="desc">${escapeHtml(a.description || '')}</div>
diff --git a/src/pumpfun-client.js b/src/pumpfun-client.js
new file mode 100644
index 000000000..5a76f3936
--- /dev/null
+++ b/src/pumpfun-client.js
@@ -0,0 +1,80 @@
+// src/pumpfun-client.js
+
+class PumpFunClient extends EventTarget {
+ constructor() {
+ super();
+ this.RPC_ENDPOINTS = [
+ { url: 'wss://pumpportal.fun/api/data', protocol: 'pumpportal', label: 'PumpPortal' },
+ { url: 'wss://pump-fun-websocket-production.up.railway.app/ws', protocol: 'relay', label: 'Relay Server' },
+ ];
+ this.rpcIndex = 0;
+ this.ws = null;
+ this.connect();
+ }
+
+ connect() {
+ const ep = this.RPC_ENDPOINTS[this.rpcIndex % this.RPC_ENDPOINTS.length];
+ this.rpcIndex++;
+ this.ws = new WebSocket(ep.url);
+
+ this.ws.onopen = () => {
+ if (ep.protocol === 'pumpportal') {
+ this.ws.send(JSON.stringify({ method: 'subscribeNewToken' }));
+ }
+ this.dispatchEvent(new CustomEvent('open'));
+ };
+
+ this.ws.onmessage = (evt) => {
+ let msg;
+ try { msg = JSON.parse(evt.data); } catch { return; }
+
+ let info = null;
+
+ if (ep.protocol === 'relay') {
+ if (msg.type === 'token-launch' || msg.mint) {
+ info = {
+ mint: msg.mint || 'unknown',
+ name: msg.name || null,
+ symbol: msg.symbol || null,
+ imageUrl: msg.imageUri || null,
+ marketCapSol: msg.marketCapSol || 0,
+ };
+ }
+ } else if (ep.protocol === 'pumpportal') {
+ if (msg && msg.mint) {
+ const vSol = msg.vSolInBondingCurve || 0;
+ const vTok = msg.vTokensInBondingCurve || 0;
+ const supply = msg.tokenTotalSupply || (vTok > 0 ? 1e15 : 0);
+ let mcap = msg.marketCapSol || 0;
+ if (!mcap && vTok > 0 && vSol > 0) {
+ mcap = (vSol / vTok) * supply / 1e9;
+ }
+ info = {
+ mint: msg.mint,
+ name: msg.name || null,
+ symbol: msg.symbol || null,
+ marketCapSol: mcap,
+ imageUrl: null,
+ };
+ }
+ }
+
+ if (info) {
+ this.dispatchEvent(new CustomEvent('token', { detail: info }));
+ }
+ };
+
+ this.ws.onclose = () => {
+ this.dispatchEvent(new CustomEvent('close'));
+ setTimeout(() => this.connect(), 1000);
+ };
+
+ this.ws.onerror = (err) => {
+ this.dispatchEvent(new CustomEvent('error', { detail: err }));
+ }
+ }
+}
+
+const pumpFunClient = new PumpFunClient();
+
+export default pumpFunClient;
diff --git a/src/viewer.js b/src/viewer.js
index af649a735..db1fe44db 100644
--- a/src/viewer.js
+++ b/src/viewer.js
@@ -47,6 +47,12 @@ import { AnimationManager } from './animation-manager.js';
Cache.enabled = true;
+/**
+ * @class Viewer
+ *
+ * @param {Element} el
+ * @param {object} options
+ */
export class Viewer {
constructor(el, options) {
this.el = el;
diff --git a/tasks/README.md b/tasks/README.md
new file mode 100644
index 000000000..28e92adba
--- /dev/null
+++ b/tasks/README.md
@@ -0,0 +1,7 @@
+# Tasks
+
+This directory contains task definitions for the 3D-Agent application.
+
+## Overview
+
+...
diff --git a/tests/README.md b/tests/README.md
new file mode 100644
index 000000000..6e3983671
--- /dev/null
+++ b/tests/README.md
@@ -0,0 +1,7 @@
+# Tests
+
+This directory contains the tests for the 3D-Agent application.
+
+## Running Tests
+
+`npm test`
diff --git a/tutorials.html b/tutorials.html
index 07f555bad..be09b4c59 100644
--- a/tutorials.html
+++ b/tutorials.html
@@ -89,6 +89,12 @@
><span class="nav-mi-sub">Khronos spec check</span></a
>
</li>
+ <li role="none">
+ <a href="/playground.html" role="menuitem"
+ ><span class="nav-mi-title">Playground</span
+ ><span class="nav-mi-sub">Experiment with agents</span></a
+ >
+ </li>
</ul>
</li>
<li role="none"><a href="/discover" role="menuitem">Discover</a></li>
@@ -198,7 +204,7 @@
</ul>
</nav>
</header>
- <main id="main-content">
+ <main id="main-content" class="h-container">
<section>
<h1>Tutorials</h1>
<p>Here you will find tutorials on how to create and use 3D agents.</p>
@@ -250,8 +256,18 @@
<h2>4. "Claude, integrate this"</h2>
<p>To simplify integration, you can use the following command to have Claude help you embed an agent. Just say "Claude, integrate agent with ID YOUR_AGENT_ID".</p>
+ <button id="claude-integrate-button" class="button-primary">Try it</button>
</section>
</main>
+ <footer class="h-footer">
+ </footer>
+ <script>
+ document.getElementById('claude-integrate-button').addEventListener('click', () => {
+ // We can't actually trigger Claude, so we'll just log to the console.
+ console.log("Imagine Claude is helping you integrate your agent now.");
+ alert("Imagine Claude is helping you integrate your agent now.");
+ });
+ </script>
</body>
</html>
diff --git a/vite.config.js b/vite.config.js
index 2dbfab506..66e521f7e 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -60,6 +60,7 @@ const appConfig = {
'a-embed': resolve(__dirname, 'a-embed.html'),
'pump-live': resolve(__dirname, 'pump-live.html'),
'pump-dashboard': resolve(__dirname, 'pump-dashboard.html'),
+ community: resolve(__dirname, 'community.html'),
studio: resolve(__dirname, 'public/studio/index.html'),
features: resolve(__dirname, 'public/features/index.html'),
reputation: resolve(__dirname, 'public/reputation/index.html'),
diff --git a/workers/README.md b/workers/README.md
new file mode 100644
index 000000000..e07b6da75
--- /dev/null
+++ b/workers/README.md
@@ -0,0 +1,7 @@
+# Workers
+
+This directory contains the background workers for the 3D-Agent application.
+
+## Overview
+
+These workers handle asynchronous tasks such as...