diff --git a/src/agents/skills.source.test.ts b/src/agents/skills.source.test.ts index 83ea4ec5eb9..058afb76e0b 100644 --- a/src/agents/skills.source.test.ts +++ b/src/agents/skills.source.test.ts @@ -10,14 +10,6 @@ describe("resolveSkillSource", () => { ).toBe("openclaw-bundled"); }); - it("falls back to legacy top-level source", () => { - expect( - resolveSkillSource({ - source: "openclaw-managed", - } as never), - ).toBe("openclaw-managed"); - }); - it("returns unknown when neither source shape is present", () => { expect(resolveSkillSource({} as never)).toBe("unknown"); }); diff --git a/src/agents/skills/compact-format.test.ts b/src/agents/skills/compact-format.test.ts index cd9d6f42f15..9f4cf961135 100644 --- a/src/agents/skills/compact-format.test.ts +++ b/src/agents/skills/compact-format.test.ts @@ -1,5 +1,9 @@ import os from "node:os"; -import { formatSkillsForPrompt, type Skill } from "@mariozechner/pi-coding-agent"; +import { + createSyntheticSourceInfo, + formatSkillsForPrompt, + type Skill, +} from "@mariozechner/pi-coding-agent"; import { describe, expect, it } from "vitest"; import type { OpenClawConfig } from "../../config/config.js"; import type { SkillEntry } from "./types.js"; @@ -15,7 +19,10 @@ function makeSkill(name: string, desc = "A skill", filePath = `/skills/${name}/S description: desc, filePath, baseDir: `/skills/${name}`, - source: "workspace", + sourceInfo: createSyntheticSourceInfo(filePath, { + source: "workspace", + baseDir: `/skills/${name}`, + }), disableModelInvocation: false, }; } diff --git a/src/agents/skills/source.ts b/src/agents/skills/source.ts index a90c47d11a2..e2e5df50c3e 100644 --- a/src/agents/skills/source.ts +++ b/src/agents/skills/source.ts @@ -1,19 +1,6 @@ import type { Skill } from "@mariozechner/pi-coding-agent"; -type SkillSourceShapeCompat = Skill & { - source?: string; - sourceInfo?: { - source?: string; - }; -}; - export function resolveSkillSource(skill: Skill): string { - const compatSkill = skill as SkillSourceShapeCompat; - const sourceInfoSource = - typeof compatSkill.sourceInfo?.source === "string" ? compatSkill.sourceInfo.source.trim() : ""; - if (sourceInfoSource) { - return sourceInfoSource; - } - const legacySource = typeof compatSkill.source === "string" ? compatSkill.source.trim() : ""; - return legacySource || "unknown"; + const source = typeof skill.sourceInfo?.source === "string" ? skill.sourceInfo.source.trim() : ""; + return source || "unknown"; }