Просмотр исходного кода

tweak: inform agent if no skills are available

Aiden Cline 1 месяц назад
Родитель
Сommit
79c263494f
2 измененных файлов с 18 добавлено и 14 удалено
  1. 0 1
      packages/opencode/src/session/system.ts
  2. 18 13
      packages/opencode/src/tool/skill.ts

+ 0 - 1
packages/opencode/src/session/system.ts

@@ -2,7 +2,6 @@ import { Ripgrep } from "../file/ripgrep"
 import { Global } from "../global"
 import { Global } from "../global"
 import { Filesystem } from "../util/filesystem"
 import { Filesystem } from "../util/filesystem"
 import { Config } from "../config/config"
 import { Config } from "../config/config"
-import { Skill } from "../skill"
 
 
 import { Instance } from "../project/instance"
 import { Instance } from "../project/instance"
 import path from "path"
 import path from "path"

+ 18 - 13
packages/opencode/src/tool/skill.ts

@@ -26,20 +26,25 @@ export const SkillTool: Tool.Info<typeof parameters> = {
       })
       })
     }
     }
 
 
+    const description =
+      accessibleSkills.length === 0
+        ? "Load a skill to get detailed instructions for a specific task. No skills are currently available."
+        : [
+            "Load a skill to get detailed instructions for a specific task.",
+            "Skills provide specialized knowledge and step-by-step guidance.",
+            "Use this when a task matches an available skill's description.",
+            "<available_skills>",
+            ...accessibleSkills.flatMap((skill) => [
+              `  <skill>`,
+              `    <name>${skill.name}</name>`,
+              `    <description>${skill.description}</description>`,
+              `  </skill>`,
+            ]),
+            "</available_skills>",
+          ].join(" ")
+
     return {
     return {
-      description: [
-        "Load a skill to get detailed instructions for a specific task.",
-        "Skills provide specialized knowledge and step-by-step guidance.",
-        "Use this when a task matches an available skill's description.",
-        "<available_skills>",
-        ...accessibleSkills.flatMap((skill) => [
-          `  <skill>`,
-          `    <name>${skill.name}</name>`,
-          `    <description>${skill.description}</description>`,
-          `  </skill>`,
-        ]),
-        "</available_skills>",
-      ].join(" "),
+      description,
       parameters,
       parameters,
       async execute(params, ctx) {
       async execute(params, ctx) {
         const agent = await Agent.get(ctx.agent)
         const agent = await Agent.get(ctx.agent)