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.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
test(okx): pin the four-part listing description against every catalog row
nirholasf888c2487dac
diff --git a/tests/api/okx-3d-services.test.js b/tests/api/okx-3d-services.test.jsindex 248d49d44..41b942daa 100644--- a/tests/api/okx-3d-services.test.js+++ b/tests/api/okx-3d-services.test.js@@ -118,8 +118,11 @@ const {OKX_CATALOG,catalogEntry,catalogIndex,+ displayWidth,listedCatalog,listingDescription,+ parameterSpec,+ requestMethod,validateCatalog,} = await import('../../api/_lib/okx-catalog.js');const studioCatalog = await import('../../api/_mcp3d/catalog.js');@@ -196,12 +199,64 @@ describe('okx catalog — work order 03 rows', () => {expect(prices['fbx-export']).toEqual(['0.10', '100000']);});- it('every paid row routes /api/okx/3d/<id>, is POST-documented, and its listing description joins the two parts', () => {+ it('every paid row routes /api/okx/3d/<id> and is POST-documented', () => {for (const id of PAID_REST_IDS) {const e = catalogEntry(id);expect(e.endpoint).toBe(`https://three.ws/api/okx/3d/${id}`);expect(e.inputSchema).toBeTruthy();- expect(listingDescription(e)).toBe(`${e.describes.capability}\n${e.describes.input}`);+ }+ });++ // OKX listing QA requires FOUR parts on an A2MCP service and rejects a+ // listing missing any of them (`onchainos agent update --help`). Submitting+ // two parts is what earned the 2026-09-02 rejection: "The service you+ // submitted is missing a complete description, parameter details, and usage+ // examples."+ it('every listed row submits four parts: capability, parameters, method, example', () => {+ for (const e of listedCatalog()) {+ const parts = listingDescription(e).split('\n');+ expect(parts, `${e.id} part count`).toHaveLength(4);+ expect(parts[0], `${e.id} capability`).toBe(e.describes.capability);+ expect(parts[1], `${e.id} parameters`).toBe(parameterSpec(e));+ expect(parts[2], `${e.id} method`).toBe(requestMethod(e));+ expect(parts[3], `${e.id} example`).toMatch(/^curl /);+ expect(parts[3], `${e.id} example hits the real endpoint`).toContain(e.endpoint);+ expect(displayWidth(listingDescription(e)), `${e.id} width`).toBeLessThanOrEqual(2000);+ }+ });++ // Part 2 is generated from the schema, so it names every argument the+ // endpoint accepts, with the type and required flag the endpoint enforces.+ it('the parameter spec names every schema property with its real type and requiredness', () => {+ for (const e of listedCatalog()) {+ const props = Object.entries(e.inputSchema?.properties || {});+ const spec = parameterSpec(e);+ if (!props.length) {+ expect(spec).toBe('No parameters. Send an empty request.');+ continue;+ }+ const required = new Set(e.inputSchema.required || []);+ for (const [name, prop] of props) {+ const type = prop.type === 'array' ? `${prop.items?.type}[]` : prop.type;+ expect(spec, `${e.id}.${name}`).toContain(+ `${name} (${type}, ${required.has(name) ? 'required' : 'optional'}):`,+ );+ }+ }+ });++ // A published usage example the endpoint would reject is worse than none:+ // the buyer copies it, gets a 400, and leaves. Validate each example against+ // the row's own schema with the same Ajv the endpoints use.+ it('every listed usage example validates against its own endpoint schema', async () => {+ const { default: Ajv } = await import('ajv');+ const { default: addFormats } = await import('ajv-formats');+ const ajv = addFormats(new Ajv({ strict: false }));+ for (const e of listedCatalog()) {+ if (!Object.keys(e.inputSchema?.properties || {}).length) continue;+ const validate = ajv.compile(e.inputSchema);+ const ok = validate(e.describes.example);+ expect(ok, `${e.id} example: ${ajv.errorsText(validate.errors)}`).toBe(true);}});diff --git a/workers/okx-chat-bot/config.js b/workers/okx-chat-bot/config.jsindex bf3d6444c..41311e9a9 100644--- a/workers/okx-chat-bot/config.js+++ b/workers/okx-chat-bot/config.js@@ -4,6 +4,7 @@// VM, and locally with no code change. The defaults are the production posture:// state persisted to GCS, heartbeat on, session probed every minute.+import { existsSync } from 'node:fs';import { homedir, hostname } from 'node:os';import { join } from 'node:path';@@ -29,18 +30,31 @@ const num = (v, fallback) => {* CLAUDE_CODE_OAUTH_TOKEN → claude* OPENAI_API_KEY → codex*+ * A headless host is credentialed by env alone, but a developer host running the+ * stopgap has no key at all: its claude CLI was logged in interactively and keeps+ * the grant in ~/.claude/.credentials.json. Ignoring that file reports+ * `ai_provider_uncredentialed` on a host whose adapter demonstrably authors+ * replies, which is a false red, and a false red trains people to ignore the+ * signal that this worker exists to raise.+ ** @param {NodeJS.ProcessEnv} env+ * @param {string} [home] where the CLI keeps an interactive login* @returns {{ provider: string, reason: string, credentialed: boolean }}*/-export function resolveProvider(env = process.env) {+export function resolveProvider(env = process.env, home = env.OKX_BOT_HOME || homedir()) {const pinned = (env.OKX_BOT_AI_PROVIDER || '').trim().toLowerCase();- const hasClaude = !!(env.ANTHROPIC_API_KEY || env.CLAUDE_CODE_OAUTH_TOKEN);+ const hasClaudeKey = !!(env.ANTHROPIC_API_KEY || env.CLAUDE_CODE_OAUTH_TOKEN);+ const hasClaudeLogin = existsSync(join(home, '.claude', '.credentials.json'));+ const hasClaude = hasClaudeKey || hasClaudeLogin;const hasCodex = !!env.OPENAI_API_KEY;if (pinned) {const credentialed = pinned === 'claude' ? hasClaude : pinned === 'codex' ? hasCodex : true;return { provider: pinned, reason: 'pinned by OKX_BOT_AI_PROVIDER', credentialed };}- if (hasClaude) return { provider: 'claude', reason: 'ANTHROPIC_API_KEY present', credentialed: true };+ if (hasClaudeKey) return { provider: 'claude', reason: 'ANTHROPIC_API_KEY present', credentialed: true };+ if (hasClaudeLogin) {+ return { provider: 'claude', reason: 'claude CLI holds an interactive login', credentialed: true };+ }if (hasCodex) return { provider: 'codex', reason: 'OPENAI_API_KEY present (no Anthropic key)', credentialed: true };return {provider: 'claude',@@ -77,13 +91,14 @@ export function resolveHost(env = process.env) {}export function loadConfig(env = process.env) {- const provider = resolveProvider(env);+ const home = env.OKX_BOT_HOME || homedir();+ const provider = resolveProvider(env, home);const host = resolveHost(env);return {// HOME for both CLIs. Everything durable lands under it:// $home/.okx-agent-task/ daemon state, sqlite, XMTP db, AI workspace// $home/.onchainos/ wallet keyring, session, machine identity- home: env.OKX_BOT_HOME || homedir(),+ home,port: num(env.PORT, 0),agentId: env.OKX_BOT_AGENT_ID || '2632',