fix(opencode): avoid duplicate skill catalog (#31269)

This commit is contained in:
Aiden Cline 2026-06-07 13:34:01 -05:00 committed by GitHub
commit aacdb34e3f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 21 deletions

View file

@ -112,7 +112,6 @@ export const layer: Layer.Layer<
const config = yield* Config.Service const config = yield* Config.Service
const plugin = yield* Plugin.Service const plugin = yield* Plugin.Service
const agents = yield* Agent.Service const agents = yield* Agent.Service
const skill = yield* Skill.Service
const truncate = yield* Truncate.Service const truncate = yield* Truncate.Service
const flags = yield* RuntimeFlags.Service const flags = yield* RuntimeFlags.Service
@ -276,25 +275,6 @@ export const layer: Layer.Layer<
return (yield* all()).map((tool) => tool.id) return (yield* all()).map((tool) => tool.id)
}) })
const describeSkill = Effect.fn("ToolRegistry.describeSkill")(function* (agent: Agent.Info) {
const list = yield* skill.available(agent)
if (list.length === 0) return "No skills are currently available."
return [
"Load a specialized skill that provides domain-specific instructions and workflows.",
"",
"When you recognize that a task matches one of the available skills listed below, use this tool to load the full skill instructions.",
"",
"The skill will inject detailed instructions, workflows, and access to bundled resources (scripts, references, templates) into the conversation context.",
"",
'Tool output includes a `<skill_content name="...">` block with the loaded content.',
"",
"The following skills provide specialized sets of instructions for particular tasks",
"Invoke this tool to load a skill when a task matches one of the available skills listed below:",
"",
Skill.fmt(list, { verbose: false }),
].join("\n")
})
const describeTask = Effect.fn("ToolRegistry.describeTask")(function* (agent: Agent.Info) { const describeTask = Effect.fn("ToolRegistry.describeTask")(function* (agent: Agent.Info) {
const items = (yield* agents.list()).filter((item) => item.mode !== "primary") const items = (yield* agents.list()).filter((item) => item.mode !== "primary")
const filtered = items.filter( const filtered = items.filter(
@ -343,7 +323,6 @@ export const layer: Layer.Layer<
description: [ description: [
output.description, output.description,
tool.id === TaskTool.id ? yield* describeTask(input.agent) : undefined, tool.id === TaskTool.id ? yield* describeTask(input.agent) : undefined,
tool.id === SkillTool.id ? yield* describeSkill(input.agent) : undefined,
] ]
.filter(Boolean) .filter(Boolean)
.join("\n"), .join("\n"),

View file

@ -68,6 +68,9 @@ Use this skill.
})).find((tool) => tool.id === SkillTool.id) })).find((tool) => tool.id === SkillTool.id)
if (!tool) throw new Error("Skill tool not found") if (!tool) throw new Error("Skill tool not found")
expect(tool.description).not.toContain("tool-skill")
expect(tool.description).not.toContain("Skill for tool tests.")
const requests: Array<Omit<PermissionV1.Request, "id" | "sessionID" | "tool">> = [] const requests: Array<Omit<PermissionV1.Request, "id" | "sessionID" | "tool">> = []
const ctx: Tool.Context = { const ctx: Tool.Context = {
...baseCtx, ...baseCtx,