Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix: update zauth middleware inclusion and enhance agent library URL in stores

nirholas94f60e42c62b
diff --git a/api/_lib/zauth.js b/api/_lib/zauth.js
index 14a941345..1c060ef5b 100644
--- a/api/_lib/zauth.js
+++ b/api/_lib/zauth.js
@@ -9,8 +9,9 @@
// Disabled cleanly when ZAUTH_API_KEY is unset — `instrument()` becomes a
// no-op so unrelated environments don't pay any cost.
//
-// Static import (not createRequire) so Vercel's @vercel/nft traces the
-// `./middleware` subpath and bundles it into the deployment.
+// Use the documented `/middleware` subpath. The middleware files are
+// force-included in the deploy via vercel.json `functions.includeFiles`
+// because @vercel/nft mis-resolves the conditional exports map otherwise.
import { zauthProvider } from '@zauthx402/sdk/middleware';
import { env } from './env.js';
diff --git a/chat/src/AgentPicker.svelte b/chat/src/AgentPicker.svelte
index 16aac5a0f..01757eb36 100644
--- a/chat/src/AgentPicker.svelte
+++ b/chat/src/AgentPicker.svelte
@@ -1,16 +1,66 @@
<script>
import { createEventDispatcher } from 'svelte';
- import { localAgentId, activeAgent } from './stores.js';
+ import { localAgentId, activeAgent, agentLibraryUrl } from './stores.js';
const dispatch = createEventDispatcher();
let query = '';
let myAgents = [];
let marketAgents = [];
+ let libraryAgents = [];
let loadingMine = false;
let loadingMarket = false;
+ let loadingLibrary = false;
let debounceTimer;
+ // Normalizes a pai-chat / lobehub library agent (index entry) into the local agent shape.
+ function normalizeLibraryAgent(item) {
+ const m = item.meta || {};
+ const avatar = m.avatar || '';
+ const isUrl = typeof avatar === 'string' && /^https?:\/\//.test(avatar);
+ return {
+ id: `lib:${item.identifier}`,
+ identifier: item.identifier,
+ name: m.title || item.identifier,
+ description: m.description || '',
+ thumbnail_url: isUrl ? avatar : null,
+ avatar_emoji: isUrl ? null : avatar,
+ tags: m.tags || [],
+ category: m.category || '',
+ source: 'library',
+ };
+ }
+
+ async function loadLibrary() {
+ loadingLibrary = true;
+ try {
+ const base = $agentLibraryUrl?.replace(/\/+$/, '') || '';
+ if (!base) return;
+ const res = await fetch(`${base}/index.en-US.json`);
+ if (res.ok) {
+ const json = await res.json();
+ libraryAgents = (json.agents || []).map(normalizeLibraryAgent);
+ }
+ } catch {}
+ loadingLibrary = false;
+ }
+
+ async function loadLibraryAgentDetail(agent) {
+ const base = $agentLibraryUrl?.replace(/\/+$/, '') || '';
+ const res = await fetch(`${base}/${agent.identifier}.json`);
+ if (!res.ok) return agent;
+ const data = await res.json();
+ const cfg = data.config || {};
+ return {
+ ...agent,
+ system_prompt: cfg.systemRole || '',
+ greeting: cfg.openingMessage || '',
+ model: cfg.model || null,
+ provider: cfg.provider || null,
+ params: cfg.params || null,
+ };
+ }
+
async function searchMarket(q) {
loadingMarket = true;
try {
diff --git a/chat/src/stores.js b/chat/src/stores.js
index d6d6158ad..7fc3b42ce 100644
--- a/chat/src/stores.js
+++ b/chat/src/stores.js
@@ -64,6 +64,7 @@ export const toolSchema = persisted('toolSchemaGroups', []);
export const ttsEnabled = persisted('ttsEnabled', false);
export const localAgentId = persisted('localAgentId', '');
export const activeAgent = persisted('activeAgentDetail', null);
+export const agentLibraryUrl = persisted('agentLibraryUrl', 'https://agents-ai-library.vercel.app');
export const talkingHeadEnabled = persisted('talkingHeadEnabled', false);
export const talkingHeadAvatarUrl = persisted('talkingHeadAvatarUrl', '');
diff --git a/vercel.json b/vercel.json
index 767003178..2ccd15c98 100644
--- a/vercel.json
+++ b/vercel.json
@@ -1,6 +1,11 @@
{
"public": true,
"installCommand": "npm ci --prefer-offline --no-audit --no-fund",
+ "functions": {
+ "api/**/*.js": {
+ "includeFiles": "node_modules/@zauthx402/sdk/dist/middleware/**"
+ }
+ },
"routes": [
{
"src": "/openapi\\.json",