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(CompanyLogo): enhance avatar rendering logic with effective agent ID handling

nirholas609a3dc65068
diff --git a/chat/src/CompanyLogo.svelte b/chat/src/CompanyLogo.svelte
index af70ab166..545164451 100644
--- a/chat/src/CompanyLogo.svelte
+++ b/chat/src/CompanyLogo.svelte
@@ -1,5 +1,5 @@
<script>
- import { talkingHeadAvatarUrl } from './stores.js';
+ import { talkingHeadAvatarUrl, localAgentId, brandConfig } from './stores.js';
import AvatarIcon from './AvatarIcon.svelte';
export let model;
@@ -10,12 +10,28 @@
// Remember to update hasCompanyLogo from convo.js when adding new logos.
const base = import.meta.env.BASE_URL;
+
+ $: effectiveAgentId = $localAgentId || $brandConfig?.agent_id || '';
</script>
{#if $talkingHeadAvatarUrl}
<span class="{size} {rounded || 'rounded-sm'} overflow-hidden inline-block shrink-0">
<AvatarIcon avatarUrl={$talkingHeadAvatarUrl} {live} />
</span>
+{:else if effectiveAgentId}
+ <span class="{size} {rounded || 'rounded-sm'} overflow-hidden inline-block shrink-0">
+ <!-- svelte-ignore custom-element-no-implicit-ns -->
+ <agent-3d
+ agent-id={effectiveAgentId}
+ mode="inline"
+ width="128"
+ height="128"
+ background="transparent"
+ kiosk
+ name-plate="off"
+ style="width:100%;height:100%;display:block;"
+ ></agent-3d>
+ </span>
{:else if model && model.provider}
{#if model.provider === 'OpenAI' || model.id.startsWith('openai')}
<img src="{base}logos/openai.ico" loading="lazy" class="{size} {rounded || 'rounded-sm'}" alt="" />
diff --git a/prompts/skills-ingestion/01-db-migration.md b/prompts/skills-ingestion/01-db-migration.md
new file mode 100644
index 000000000..1c65fcff9
--- /dev/null
+++ b/prompts/skills-ingestion/01-db-migration.md
@@ -0,0 +1,54 @@
+# Step 1 — DB migration: add `content`, make `schema_json` nullable
+
+Working directory: `/workspaces/3D-Agent`. Read `/workspaces/3D-Agent/CLAUDE.md` and `/workspaces/3D-Agent/api/CLAUDE.md` first.
+
+## Context
+
+The `marketplace_skills` table is defined in `api/_lib/schema.sql:724-740`. Today every skill must have `schema_json` (an array of OpenAI tool definitions). We are introducing **content skills** (markdown knowledge injected into system prompt) which have no tool schema, only markdown content.
+
+Existing migrations live in `api/_lib/migrations/` with the convention `YYYY-MM-DD-<topic>.sql`. Today is 2026-05-01.
+
+## Task
+
+Create exactly one migration file that:
+
+1. Adds a nullable `content text` column to `marketplace_skills`.
+2. Makes `schema_json` nullable (`alter column schema_json drop not null`).
+3. Adds a check constraint enforcing that **every row has at least one of**: `schema_json` or `content`. Constraint name: `marketplace_skills_has_payload`.
+4. Updates the canonical schema at `api/_lib/schema.sql` so the `create table` block reflects the new shape, and the check constraint is included. Keep the existing comment block above the table; update it to mention content skills.
+
+Migration file path: `api/_lib/migrations/2026-05-01-skills-content-column.sql`.
+
+Use `if not exists` / `if exists` guards so the migration is idempotent. Do not drop or rewrite anything else.
+
+## Apply migration
+
+The repo uses Neon. Migrations are applied via whatever runner is wired up in this project — check `package.json`, `scripts/migrations/`, or a README to find the existing command. **Do not invent a new runner.** If you cannot find a runner, run the SQL directly via `psql "$DATABASE_URL" -f api/_lib/migrations/2026-05-01-skills-content-column.sql` and note this in your report.
+
+## Verification
+
+Run against the real DB (no mocks):
+
+```bash
+psql "$DATABASE_URL" -c "\d marketplace_skills"
+```
+
+Confirm:
+- `content` column present, type `text`, nullable.
+- `schema_json` is nullable.
+- Constraint `marketplace_skills_has_payload` listed.
+
+Then sanity-check the constraint:
+
+```bash
+psql "$DATABASE_URL" -c "INSERT INTO marketplace_skills (name, slug, description) VALUES ('t','t-test','t');"
+```
+
+This MUST fail with the check-constraint violation. Then `DELETE FROM marketplace_skills WHERE slug = 't-test';` (it shouldn't have been inserted, but make sure).
+
+## Done means
+
+- Migration file exists and applied.
+- Schema matches in `api/_lib/schema.sql`.
+- `\d marketplace_skills` shows the new shape.
+- Constraint blocks rows that have neither `schema_json` nor `content`.
diff --git a/prompts/skills-ingestion/02-api-content-support.md b/prompts/skills-ingestion/02-api-content-support.md
new file mode 100644
index 000000000..d78b5768f
--- /dev/null
+++ b/prompts/skills-ingestion/02-api-content-support.md
@@ -0,0 +1,84 @@
+# Step 2 — API: support `content` in validation, responses, install
+
+Working directory: `/workspaces/3D-Agent`. Read `/workspaces/3D-Agent/api/CLAUDE.md` first.
+
+## Prerequisite
+
+Step 1 (`01-db-migration.md`) must be applied. Verify:
+
+```bash
+psql "$DATABASE_URL" -c "\d marketplace_skills" | grep -E "content|schema_json"
+```
+
+`content text` must exist; `schema_json` must be nullable.
+
+## Files to modify
+
+1. `api/skills/index.js` — list endpoint + publish (POST).
+2. `api/skills/[id].js` — get-by-id + update (PUT).
+3. `api/skills/[id]/install.js` — install endpoint that returns the payload to the client.
+4. `api/skills/categories.js` — only if it touches schema; otherwise leave it.
+
+## Required changes
+
+### `api/skills/index.js`
+
+Current `publishSchema` (lines ~20-39) requires `schema_json` with `min(1)`. Change to:
+
+- Add `content: z.string().trim().min(1).max(200000).optional()` to `publishSchema`.
+- Make `schema_json` `.optional()` (remove `.min(1)` floor or replace with `.array(...).min(1).optional()`).
+- After `parse()`, enforce in JS: at least one of `schema_json` or `content` must be present; otherwise return `error(res, 400, 'validation_error', 'skill must have schema_json or content')`.
+- In the `INSERT INTO marketplace_skills (...)` statement, add `content` column and bind `${body.content ?? null}`. If `schema_json` is absent, bind `NULL` (not `'[]'::jsonb`).
+- In `handleList`, include `ms.content` in the SELECT and in the `toSkill(...)` shape (or its inline equivalent in this file). For the **list response**, return only a boolean `has_content` and the first ~280 chars of content as `content_preview` to keep payloads small. Full content is fetched via the detail endpoint.
+
+### `api/skills/[id].js`
+
+- Add `content` to `updateSchema` (`z.string().trim().max(200000).optional()`).
+- In `toSkill(row, ...)` (lines ~49-67), add `content: row.content ?? null` to the returned shape. Detail endpoint always returns full content.
+- In `handleUpdate`, when `body.content !== undefined`, push `sql\`content = ${body.content}\`` into `updates`.
+
+### `api/skills/[id]/install.js`
+
+- Change the SELECT to include `content`: `SELECT id, schema_json, content FROM marketplace_skills WHERE ...`.
+- On POST success, return `{ installed: true, schema_json: skill.schema_json, content: skill.content }` so the client can decide whether to register tools or inject system-prompt content.
+
+## Hard rules
+
+- No mocks. Test against the real Neon DB.
+- Use `sql` tagged template, never string-concat.
+- Don't change response shapes beyond what's specified above. The existing modal still consumes `schema_json` for tool-pack skills.
+- Don't add new endpoints. Don't add new auth modes.
+
+## Verification
+
+Run real curl against the dev server (or whatever the project's dev command is — check `package.json`). Examples assume the API is at `http://localhost:3000`:
+
+1. **List** returns the new `has_content` flag and `content_preview` for content rows (will be empty until step 3 seeds data — that's fine; the field should still serialize).
+
+ ```bash
+ curl -s 'http://localhost:3000/api/skills?limit=1' | jq '.skills[0] | keys'
+ ```
+
+ Expect `has_content` and `content_preview` in the keys.
+
+2. **Detail** for a tool-pack skill (any existing row) still returns its `schema_json`.
+
+ ```bash
+ curl -s "http://localhost:3000/api/skills/<existing-id>" | jq '.skill | {schema_json: (.schema_json|type), content}'
+ ```
+
+3. **Constraint enforcement** — try posting a skill with neither `schema_json` nor `content`:
+
+ ```bash
+ curl -s -X POST http://localhost:3000/api/skills \
+ -H 'content-type: application/json' --cookie "<session>" \
+ -d '{"name":"x","slug":"x-test","description":"x"}'
+ ```
+
+ MUST return 400 `validation_error`.
+
+## Done means
+
+- All four endpoints accept and return `content` per spec.
+- Existing tool-pack skills behavior is unchanged (regression check: install one, confirm `schema_json` still flows through).
+- 400 on payload-less publish.