tweak: adjust way skills are presented to agent to increase likelyhood of skill invocations. (#17053)

This commit is contained in:
Aiden Cline
2026-03-11 10:24:55 -05:00
committed by GitHub
parent 7291e28273
commit 0f6bc8ae71
4 changed files with 50 additions and 24 deletions

View File

@@ -13,6 +13,9 @@ import { Bus } from "@/bus"
import { Session } from "@/session"
import { Discovery } from "./discovery"
import { Glob } from "../util/glob"
import { pathToFileURL } from "url"
import type { Agent } from "@/agent/agent"
import { PermissionNext } from "@/permission/next"
export namespace Skill {
const log = Log.create({ service: "skill" })
@@ -186,4 +189,24 @@ export namespace Skill {
export async function dirs() {
return state().then((x) => x.dirs)
}
export async function available(agent?: Agent.Info) {
const list = await all()
if (!agent) return list
return list.filter((skill) => PermissionNext.evaluate("skill", skill.name, agent.permission).action !== "deny")
}
export function fmt(list: Info[]) {
return [
"<available_skills>",
...list.flatMap((skill) => [
` <skill>`,
` <name>${skill.name}</name>`,
` <description>${skill.description}</description>`,
` <location>${pathToFileURL(skill.location).href}</location>`,
` </skill>`,
]),
"</available_skills>",
].join("\n")
}
}