Skip to content

Commit b7c6154

Browse files
committed
fix(agent): show skill display name, not slug, for committed embeds
describeSkill now resolves the embed's sibling name or the referenced workflow's name (via staticEmbedName), falling back to the slug, so committed static/embedded skills render their human name instead of the raw __ag__* slug. Claude-Session: https://claude.ai/code/session_01LUTGjUDzSX1tiJwqnqACtj
1 parent c575cd7 commit b7c6154

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/agentTemplate/itemDescriptors.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,15 @@ export function staticEmbedSlug(skill: Record<string, unknown>): string | undefi
201201
return typeof slug === "string" ? slug : undefined
202202
}
203203

204+
/** Display name for an embedded skill: the embed's sibling `name`, else the referenced workflow's
205+
* `name`. Callers fall back to the slug when this is undefined. */
206+
export function staticEmbedName(skill: Record<string, unknown>): string | undefined {
207+
if (typeof skill.name === "string" && skill.name) return skill.name
208+
const refs = asObj(asObj(skill["@ag.embed"])?.["@ag.references"])
209+
const wfName = asObj(refs?.workflow)?.name ?? asObj(refs?.workflow_revision)?.name
210+
return typeof wfName === "string" && wfName ? wfName : undefined
211+
}
212+
204213
/** A pinned revision's version, when the embed references a `workflow_revision`. */
205214
function embedRevisionVersion(skill: Record<string, unknown>): string | undefined {
206215
const refs = asObj(asObj(skill["@ag.embed"])?.["@ag.references"])
@@ -228,7 +237,7 @@ export function describeSkill(skill: unknown): ItemDescriptor {
228237
const slug = staticEmbedSlug(s)
229238
const version = embedRevisionVersion(s)
230239
return {
231-
name: slug ?? "Static skill",
240+
name: staticEmbedName(s) ?? slug ?? "Static skill",
232241
mono: "sk",
233242
color: "#6b7280",
234243
tags: version ? ["static", `v${version}`] : ["static"],
@@ -238,7 +247,7 @@ export function describeSkill(skill: unknown): ItemDescriptor {
238247
}
239248
if (isEmbedRefSkill(s)) {
240249
return {
241-
name: "Skill reference",
250+
name: staticEmbedName(s) ?? staticEmbedSlug(s) ?? "Skill reference",
242251
mono: "sk",
243252
color: "#b45309",
244253
tags: ["@ag.embed"],

0 commit comments

Comments
 (0)