Avatar Customization + Update Agent Brain (#23)

Co-authored-by: iamlukethedev <iamlukethedev@users.noreply.github.com>
This commit is contained in:
Luke The Dev
2026-03-20 23:05:14 -05:00
committed by GitHub
parent a5b0895dd8
commit 65c2b9cf85
39 changed files with 2803 additions and 551 deletions
+15 -8
View File
@@ -1,10 +1,11 @@
import type { Page, Route, Request } from "@playwright/test";
import type { AgentAvatarProfile } from "@/lib/avatars/profile";
export type StudioSettingsFixture = {
version: 1;
gateway: { url: string; token: string } | null;
focused: Record<string, { mode: "focused"; filter: string; selectedAgentId: string | null }>;
avatars: Record<string, Record<string, string>>;
avatars: Record<string, Record<string, AgentAvatarProfile>>;
};
const DEFAULT_SETTINGS: StudioSettingsFixture = {
@@ -65,25 +66,31 @@ const createStudioRoute = (initial: StudioSettingsFixture = DEFAULT_SETTINGS) =>
}
if (patch.avatars && typeof patch.avatars === "object") {
const avatarsPatch = patch.avatars as Record<string, Record<string, string | null> | null>;
const avatarsPatch = patch.avatars as
| Record<string, Record<string, AgentAvatarProfile | null> | null>
| null;
const avatarsNext: StudioSettingsFixture["avatars"] = { ...next.avatars };
for (const [gatewayKey, gatewayPatch] of Object.entries(avatarsPatch)) {
for (const [gatewayKey, gatewayPatch] of Object.entries(avatarsPatch ?? {})) {
if (gatewayPatch === null) {
delete avatarsNext[gatewayKey];
continue;
}
const existing = avatarsNext[gatewayKey] ? { ...avatarsNext[gatewayKey] } : {};
for (const [agentId, seedPatch] of Object.entries(gatewayPatch)) {
if (seedPatch === null) {
for (const [agentId, avatarPatch] of Object.entries(gatewayPatch)) {
if (avatarPatch === null) {
delete existing[agentId];
continue;
}
const seed = typeof seedPatch === "string" ? seedPatch.trim() : "";
if (!seed) {
if (
typeof avatarPatch !== "object" ||
avatarPatch === null ||
typeof avatarPatch.seed !== "string" ||
avatarPatch.seed.trim().length === 0
) {
delete existing[agentId];
continue;
}
existing[agentId] = seed;
existing[agentId] = avatarPatch;
}
avatarsNext[gatewayKey] = existing;
}