LeoYeAI/agent-master-skills / skills/agent-chat-ux-v1-4-0
agent-chat-ux
VerifiedMulti-agent UX for OpenClaw Control UI — agent selector, per-agent sessions, session history viewer with search, agent-filtered Sessions tab with friendly names, Create Agent wizard, emoji picker, and backend agent CRUD.
| File | Kind | Size |
|---|---|---|
| .metadata.json | config | 5.6 KB |
| SKILL.md | skill md | 27.1 KB |
| _meta.json | config | 329 B |
| references/agents-panels-cron.txt | markdown | 1.9 KB |
| references/agents-utils.txt | markdown | 2.4 KB |
| references/agents-view.txt | markdown | 13.5 KB |
| references/app-main.txt | markdown | 850 B |
| references/app-render-helpers.txt | markdown | 1.1 KB |
| references/app-render.txt | markdown | 7.4 KB |
| references/schema-agents.txt | markdown | 561 B |
| references/server-agents.txt | markdown | 4.5 KB |
| references/v1.4.0/patch-01-sessions-history-rpc.txt | markdown | 7.3 KB |
| references/v1.4.0/patch-02-sessions-tab-overhaul.txt | markdown | 14.5 KB |
| references/v1.4.0/patch-03-app-wiring.txt | markdown | 8.8 KB |
| references/v1.4.0/patch-04-sessions-history-modal.ts | script | 9.4 KB |
| references/v1.4.0/patch-05-chat-sessions-all.txt | markdown | 441 B |
references/server-agents.txt
View on GitHubdiff --git a/src/gateway/server-methods/agents.ts b/src/gateway/server-methods/agents.ts
index e230c33c4..ceb311d1a 100644
--- a/src/gateway/server-methods/agents.ts
+++ b/src/gateway/server-methods/agents.ts
@@ -327,6 +327,7 @@ export const agentsHandlers: GatewayRequestHandlers = {
const model = resolveOptionalStringParam(params.model);
const avatar = resolveOptionalStringParam(params.avatar);
+ const emoji = resolveOptionalStringParam(params.emoji);
const nextConfig = applyAgentConfig(cfg, {
agentId,
@@ -344,11 +345,28 @@ export const agentsHandlers: GatewayRequestHandlers = {
await ensureAgentWorkspace({ dir: workspaceDir, ensureBootstrapFiles: !skipBootstrap });
}
- if (avatar) {
+ // Write name, emoji, and/or avatar to IDENTITY.md so the loaded identity reflects the change.
+ // Parsing uses last-wins, so appending overrides existing values cleanly.
+ // IMPORTANT: emoji must be written as "- Emoji:" (not "- Avatar:") so it overrides the
+ // original "- Emoji:" line set at creation time. agentIdentity.emoji takes higher priority
+ // than agentIdentity.avatar in resolveAgentEmoji(), so using Avatar would never override.
+ const identityName =
+ typeof params.name === "string" && params.name.trim() ? params.name.trim() : null;
+ if (identityName || emoji || avatar) {
const workspace = workspaceDir ?? resolveAgentWorkspaceDir(nextConfig, agentId);
await fs.mkdir(workspace, { recursive: true });
const identityPath = path.join(workspace, DEFAULT_IDENTITY_FILENAME);
- await fs.appendFile(identityPath, `\n- Avatar: ${sanitizeIdentityLine(avatar)}\n`, "utf-8");
+ const lines: string[] = [];
+ if (identityName) {
+ lines.push(`- Name: ${sanitizeIdentityLine(identityName)}`);
+ }
+ if (emoji) {
+ lines.push(`- Emoji: ${sanitizeIdentityLine(emoji)}`);
+ }
+ if (avatar) {
+ lines.push(`- Avatar: ${sanitizeIdentityLine(avatar)}`);
+ }
+ await fs.appendFile(identityPath, `\n${lines.join("\n")}\n`, "utf-8");
}
respond(true, { ok: true, agentId }, undefined);
@@ -654,18 +672,66 @@ The SOUL.md should be thoughtful and specific to the agent's purpose. Include se
text = choices[0]?.message?.content ?? "";
}
- // Parse JSON from response (strip any markdown fences)
+ // Parse and validate JSON from response (strip any markdown fences first)
const cleaned = text
.replace(/```json?\s*/g, "")
.replace(/```\s*/g, "")
.trim();
- const result = JSON.parse(cleaned) as { name: string; emoji: string; soul: string };
+ if (!cleaned) {
+ respond(
+ false,
+ undefined,
+ errorShape(ErrorCodes.INTERNAL_ERROR, "Model returned empty response"),
+ );
+ return;
+ }
+ let parsed: unknown;
+ try {
+ parsed = JSON.parse(cleaned);
+ } catch {
+ wizLog.error("Failed to parse model JSON", { raw: cleaned.slice(0, 200) });
+ respond(
+ false,
+ undefined,
+ errorShape(ErrorCodes.INTERNAL_ERROR, "Model returned non-JSON output"),
+ );
+ return;
+ }
+ // Structural validation — reject if required fields are missing or wrong type
+ if (
+ typeof parsed !== "object" ||
+ parsed === null ||
+ typeof (parsed as Record<string, unknown>).name !== "string" ||
+ typeof (parsed as Record<string, unknown>).emoji !== "string" ||
+ typeof (parsed as Record<string, unknown>).soul !== "string"
+ ) {
+ wizLog.error("Model JSON missing required fields", { parsed });
+ respond(
+ false,
+ undefined,
+ errorShape(
+ ErrorCodes.INTERNAL_ERROR,
+ "Model output missing required fields (name, emoji, soul)",
+ ),
+ );
+ return;
+ }
+ const result = parsed as { name: string; emoji: string; soul: string };
+ // Sanity-check field lengths to catch truncated or empty output
+ if (!result.name.trim() || !result.emoji.trim() || result.soul.length < 20) {
+ respond(
+ false,
+ undefined,
+ errorShape(ErrorCodes.INTERNAL_ERROR, "Model output fields appear empty or truncated"),
+ );
+ return;
+ }
respond(
true,
{
- name: result.name,
- emoji: result.emoji,
+ name: result.name.trim().slice(0, 100),
+ emoji: result.emoji.trim().slice(0, 10),
soul: result.soul,
},
undefined,
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |