tweak: adjust skill tool description to make it more clear which skills are available
This commit is contained in:
@@ -9,7 +9,6 @@ import { Global } from "@/global"
|
|||||||
import { Filesystem } from "@/util/filesystem"
|
import { Filesystem } from "@/util/filesystem"
|
||||||
import { Flag } from "@/flag/flag"
|
import { Flag } from "@/flag/flag"
|
||||||
import { Bus } from "@/bus"
|
import { Bus } from "@/bus"
|
||||||
import { TuiEvent } from "@/cli/cmd/tui/event"
|
|
||||||
import { Session } from "@/session"
|
import { Session } from "@/session"
|
||||||
|
|
||||||
export namespace Skill {
|
export namespace Skill {
|
||||||
|
|||||||
@@ -5,10 +5,6 @@ import { Skill } from "../skill"
|
|||||||
import { ConfigMarkdown } from "../config/markdown"
|
import { ConfigMarkdown } from "../config/markdown"
|
||||||
import { PermissionNext } from "../permission/next"
|
import { PermissionNext } from "../permission/next"
|
||||||
|
|
||||||
const parameters = z.object({
|
|
||||||
name: z.string().describe("The skill identifier from available_skills (e.g., 'code-review' or 'category/helper')"),
|
|
||||||
})
|
|
||||||
|
|
||||||
export const SkillTool = Tool.define("skill", async (ctx) => {
|
export const SkillTool = Tool.define("skill", async (ctx) => {
|
||||||
const skills = await Skill.all()
|
const skills = await Skill.all()
|
||||||
|
|
||||||
@@ -28,6 +24,7 @@ export const SkillTool = Tool.define("skill", async (ctx) => {
|
|||||||
"Load a skill to get detailed instructions for a specific task.",
|
"Load a skill to get detailed instructions for a specific task.",
|
||||||
"Skills provide specialized knowledge and step-by-step guidance.",
|
"Skills provide specialized knowledge and step-by-step guidance.",
|
||||||
"Use this when a task matches an available skill's description.",
|
"Use this when a task matches an available skill's description.",
|
||||||
|
"Only the skills listed here are available:",
|
||||||
"<available_skills>",
|
"<available_skills>",
|
||||||
...accessibleSkills.flatMap((skill) => [
|
...accessibleSkills.flatMap((skill) => [
|
||||||
` <skill>`,
|
` <skill>`,
|
||||||
@@ -38,6 +35,16 @@ export const SkillTool = Tool.define("skill", async (ctx) => {
|
|||||||
"</available_skills>",
|
"</available_skills>",
|
||||||
].join(" ")
|
].join(" ")
|
||||||
|
|
||||||
|
const examples = accessibleSkills
|
||||||
|
.map((skill) => `'${skill.name}'`)
|
||||||
|
.slice(0, 3)
|
||||||
|
.join(", ")
|
||||||
|
const hint = examples.length > 0 ? ` (e.g., ${examples}, ...)` : ""
|
||||||
|
|
||||||
|
const parameters = z.object({
|
||||||
|
name: z.string().describe(`The skill identifier from available_skills${hint}`),
|
||||||
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
description,
|
description,
|
||||||
parameters,
|
parameters,
|
||||||
|
|||||||
Reference in New Issue
Block a user