fix: generate skill/slashcommand descriptions synchronously when pre-provided (#1087)
* fix: generate skill/slashcommand tool descriptions synchronously when pre-provided When skills are passed via options (pre-resolved), build the tool description synchronously instead of fire-and-forget async. This eliminates the race condition where the description getter returns the bare prefix before the async cache-warming microtask completes. Fixes #1039 * chore: changes by sisyphus-dev-ai --------- Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com>
This commit is contained in:
@@ -147,7 +147,14 @@ export function createSkillTool(options: SkillLoadOptions = {}): ToolDefinition
|
||||
return cachedDescription
|
||||
}
|
||||
|
||||
getDescription()
|
||||
if (options.skills) {
|
||||
const skillInfos = options.skills.map(loadedSkillToInfo)
|
||||
cachedDescription = skillInfos.length === 0
|
||||
? TOOL_DESCRIPTION_NO_SKILLS
|
||||
: TOOL_DESCRIPTION_PREFIX + formatSkillsXml(skillInfos)
|
||||
} else {
|
||||
getDescription()
|
||||
}
|
||||
|
||||
return tool({
|
||||
get description() {
|
||||
|
||||
Reference in New Issue
Block a user