fix: load skill content via lazyContentLoader in slashcommand tool

- Fix #542: slashcommand tool returns empty content for skills
- Add lazyContentLoader to CommandInfo type
- Load skill content in formatLoadedCommand when content is empty
- Filter non-ultrawork keywords in subagent sessions
This commit is contained in:
YeonGyu-Kim
2026-01-07 01:41:42 +09:00
parent d331b484f9
commit ad44af9d15
3 changed files with 35 additions and 3 deletions

View File

@@ -21,12 +21,37 @@ export function createKeywordDetectorHook(ctx: PluginInput) {
}
): Promise<void> => {
const promptText = extractPromptText(output.parts)
const detectedKeywords = detectKeywordsWithType(removeCodeBlocks(promptText), input.agent)
let detectedKeywords = detectKeywordsWithType(removeCodeBlocks(promptText), input.agent)
if (detectedKeywords.length === 0) {
return
}
// Check if this is a subagent session (has parent)
// Only ultrawork keywords work in subagent sessions
// Other keywords (search, analyze, etc.) only work in main sessions
try {
const sessionInfo = await ctx.client.session.get({ path: { id: input.sessionID } })
const isSubagentSession = !!sessionInfo.data?.parentID
if (isSubagentSession) {
// Filter to only ultrawork keywords in subagent sessions
detectedKeywords = detectedKeywords.filter((k) => k.type === "ultrawork")
if (detectedKeywords.length === 0) {
log(`[keyword-detector] Skipping non-ultrawork keywords in subagent session`, {
sessionID: input.sessionID,
parentID: sessionInfo.data?.parentID,
})
return
}
}
} catch (err) {
log(`[keyword-detector] Failed to get session info, proceeding with all keywords`, {
error: err,
sessionID: input.sessionID,
})
}
const hasUltrawork = detectedKeywords.some((k) => k.type === "ultrawork")
if (hasUltrawork) {
log(`[keyword-detector] Ultrawork mode activated`, { sessionID: input.sessionID })