Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

fix(eve): tolerate shared skill metadata (#1798)

OwenKephartd7fef87c9f08
diff --git a/.changeset/quiet-skills-import.md b/.changeset/quiet-skills-import.md
new file mode 100644
index 000000000..acd289df7
--- /dev/null
+++ b/.changeset/quiet-skills-import.md
@@ -0,0 +1,5 @@
+---
+"eve": patch
+---
+
+Import skills with structured or non-string metadata without failing, treating metadata outside eve's modeled shape like other unmodeled frontmatter.
diff --git a/docs/skills.mdx b/docs/skills.mdx
index 3b676c323..030f1a26a 100644
--- a/docs/skills.mdx
+++ b/docs/skills.mdx
@@ -44,7 +44,7 @@ A skill's name comes from its path and must use only ASCII letters, digits, unde
A flat markdown skill can skip the `description` frontmatter. When it does, eve advertises the first non-empty, non-code-fence line of the body with any leading `#`, `>`, `*`, or `-` marker stripped. If the body has no such line, eve falls back to the literal `Instructions for the <name> skill.`, which is a weak routing hint, so add a `description` when you want the model to route on intent.
-A packaged skill is a directory with a `SKILL.md` plus sibling files like `references/`, `assets/`, and `scripts/`. The packaged `SKILL.md` must carry `description` frontmatter; it has no filename slug to fall back on.
+A packaged skill is a directory with a `SKILL.md` plus sibling files like `references/`, `assets/`, and `scripts/`. The packaged `SKILL.md` must carry `description` frontmatter; it has no filename slug to fall back on. eve ignores frontmatter it does not use so skills authored for other Agent Skills clients remain importable.
```md title="agent/skills/research/SKILL.md"
---
diff --git a/packages/eve/src/discover/skills.integration.test.ts b/packages/eve/src/discover/skills.integration.test.ts
index af7abb9c6..3d48b038a 100644
--- a/packages/eve/src/discover/skills.integration.test.ts
+++ b/packages/eve/src/discover/skills.integration.test.ts
@@ -161,6 +161,7 @@ describe("discoverSkills (memory)", () => {
"name: other-name",
"description: Use the weather tool before answering forecast questions.",
"argument-hint: '[location]'",
+ "allowed-tools: Bash Read",
"disable-model-invocation: true",
"---",
"When the user asks about weather, call the weather tool before answering.",
@@ -170,7 +171,7 @@ describe("discoverSkills (memory)", () => {
"name: other-name",
"description: Research complex weather questions.",
"argument-hint: '[topic]'",
- "disable-model-invocation: true",
+ "disable-model-invocation: false",
"---",
"Research weather patterns before replying.",
].join("\n"),
diff --git a/packages/eve/src/internal/helpers/markdown.test.ts b/packages/eve/src/internal/helpers/markdown.test.ts
index ea9333118..0c0c27fea 100644
--- a/packages/eve/src/internal/helpers/markdown.test.ts
+++ b/packages/eve/src/internal/helpers/markdown.test.ts
@@ -111,6 +111,24 @@ When the user asks about weather, call the weather tool before answering.`),
);
});
+ it("treats metadata outside eve's flat string map as a no-op", () => {
+ expect(
+ lowerSkillMarkdown(`---
+description: Use the Lark CLI before answering document questions.
+metadata:
+ requires:
+ bins: [lark-cli]
+ enabled: true
+---
+Use lark-cli to answer the question.`),
+ ).toEqual(
+ defineSkill({
+ description: "Use the Lark CLI before answering document questions.",
+ markdown: "Use lark-cli to answer the question.",
+ }),
+ );
+ });
+
it("derives flat skill metadata from plain markdown when no frontmatter is present", () => {
expect(
lowerSkillMarkdown("Use the weather tool before answering forecast questions.", {
diff --git a/packages/eve/src/internal/helpers/markdown.ts b/packages/eve/src/internal/helpers/markdown.ts
index 47365a54e..f13ad521a 100644
--- a/packages/eve/src/internal/helpers/markdown.ts
+++ b/packages/eve/src/internal/helpers/markdown.ts
@@ -174,7 +174,7 @@ function applyOptionalSkillFrontmatter(
rawDefinition.license = license;
}
- const metadata = toOptionalStringRecord(frontmatter.metadata, "metadata");
+ const metadata = toOptionalStringRecord(frontmatter.metadata);
if (metadata !== undefined) {
rawDefinition.metadata = metadata;
}
@@ -210,27 +210,17 @@ function requireStringFrontmatter(value: unknown, fieldName: string): string {
return normalizedValue;
}
-function toOptionalStringRecord(
- value: unknown,
- fieldName: string,
-): Record<string, string> | undefined {
- if (value === undefined || value === null) {
+function toOptionalStringRecord(value: unknown): Record<string, string> | undefined {
+ if (!isObject(value)) {
return undefined;
}
- if (!isObject(value)) {
- throw new Error(`Expected "${fieldName}" frontmatter to be an object.`);
+ const entries = Object.entries(value);
+ if (entries.some(([, entryValue]) => typeof entryValue !== "string")) {
+ return undefined;
}
- const stringEntries = Object.entries(value).map(([key, entryValue]) => {
- if (typeof entryValue !== "string") {
- throw new Error(`Expected "${fieldName}.${key}" frontmatter to be a string.`);
- }
-
- return [key, entryValue] as const;
- });
-
- return Object.fromEntries(stringEntries);
+ return Object.fromEntries(entries) as Record<string, string>;
}
function deriveFlatSkillDescription(markdown: string, name: string): string {