mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-16 13:05:14 +03:00
refactor(core): return directory and content from the skill tool (#63623)
This commit is contained in:
committed by
GitHub
Unverified
parent
f1bbaea632
commit
9070bff302
@@ -14,9 +14,8 @@ export const Input = Schema.Struct({
|
||||
})
|
||||
|
||||
export const Output = Schema.Struct({
|
||||
name: Skill.Name,
|
||||
directory: Schema.String,
|
||||
output: Schema.String,
|
||||
content: Schema.String,
|
||||
})
|
||||
export const description = [
|
||||
"Load a specialized skill's instructions and resources into the current conversation when the task at hand matches its description.",
|
||||
@@ -55,15 +54,14 @@ export const Plugin = {
|
||||
...Permission.invocation(context),
|
||||
})
|
||||
const files = yield* skills.files(skill.id)
|
||||
return { name: skill.name, ...(yield* Skill.prepare(fs, skill, files)) }
|
||||
const { directory, output: content } = yield* Skill.prepare(fs, skill, files)
|
||||
return {
|
||||
output: { directory, content },
|
||||
content,
|
||||
metadata: { name: skill.name, directory },
|
||||
}
|
||||
}).pipe(Effect.mapError((error) => unableToLoad(input.id, error)))
|
||||
}).pipe(
|
||||
Effect.map((output) => ({
|
||||
output,
|
||||
content: output.output,
|
||||
metadata: { name: output.name, directory: output.directory },
|
||||
})),
|
||||
),
|
||||
}),
|
||||
}),
|
||||
)
|
||||
.pipe(Effect.orDie)
|
||||
|
||||
@@ -139,7 +139,7 @@ describe("SkillTool", () => {
|
||||
}),
|
||||
).toEqual({
|
||||
status: "completed",
|
||||
output: { name: "Effect", directory, output: Skill.toModelOutput(info, [reference]) },
|
||||
output: { directory, content: Skill.toModelOutput(info, [reference]) },
|
||||
content: [{ type: "text", text: Skill.toModelOutput(info, [reference]) }],
|
||||
metadata: { name: "Effect", directory },
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user