mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-17 13:01:05 +01:00
Refine agent details, identity editing, responsive controls, and organization charts with three card tiers, clearer save feedback, and stable filtering. Guard instruction-file renames and root configuration updates in one transaction through the agent lifecycle integration, preserving conflict checks, rollback, and configuration history. Co-Authored-By: Paperclip <noreply@paperclip.ing>
18 lines
857 B
TypeScript
18 lines
857 B
TypeScript
import { parentPort } from "node:worker_threads";
|
|
import sharp from "sharp";
|
|
import { renderAgentSvg } from "@paperclipai/shared/cliplab/static";
|
|
import { PAPERCLIP_DARK_AVATAR_BACKGROUND } from "@paperclipai/shared";
|
|
import type { AgentAvatarRequest } from "./agent-avatars.js";
|
|
|
|
parentPort!.on("message", async (request: AgentAvatarRequest) => {
|
|
try {
|
|
const svg = renderAgentSvg(request.appearance, request.size, request.scale, request.pose, request.muted, request.view);
|
|
const image = sharp(Buffer.from(svg));
|
|
if (request.background === "paperclip-dark") image.flatten({ background: PAPERCLIP_DARK_AVATAR_BACKGROUND });
|
|
const png = await image.png().toBuffer();
|
|
parentPort!.postMessage({ png });
|
|
} catch (error) {
|
|
parentPort!.postMessage({ error: error instanceof Error ? error.message : "Avatar rendering failed" });
|
|
}
|
|
});
|