Skip to content

Commit eb833da

Browse files
fix: 创建 agent 后刷新 loadMarkdownFilesForSubdir 缓存
新建 agent 后 clearAgentDefinitionsCache 漏清底层 loadMarkdownFilesForSubdir 的 memoize 缓存,导致新 agent 不会立即出现在列表中,需要重启才能生效。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent eadd32a commit eb833da

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

packages/builtin-tools/src/tools/AgentTool/loadAgentsDir.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ export const getAgentDefinitionsWithOverrides = memoize(
394394

395395
export function clearAgentDefinitionsCache(): void {
396396
getAgentDefinitionsWithOverrides.cache.clear?.()
397+
loadMarkdownFilesForSubdir.cache?.clear?.()
397398
clearPluginAgentCache()
398399
}
399400

src/components/agents/new-agent-creation/wizard-steps/ConfirmStepWrapper.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { useSetAppState } from 'src/state/AppState.js'
88
import type { Tools } from '../../../../Tool.js'
99
import type { AgentDefinition } from '@claude-code-best/builtin-tools/tools/AgentTool/loadAgentsDir.js'
1010
import { getActiveAgentsFromList } from '@claude-code-best/builtin-tools/tools/AgentTool/loadAgentsDir.js'
11+
import { clearAgentDefinitionsCache } from '@claude-code-best/builtin-tools/tools/AgentTool/loadAgentsDir.js'
1112
import { editFileInEditor } from '../../../../utils/promptEditor.js'
1213
import { useWizard } from '../../../wizard/index.js'
1314
import { getNewAgentFilePath, saveAgentToFile } from '../../agentFileUtils.js'
@@ -62,6 +63,8 @@ export function ConfirmStepWrapper({
6263
}
6364
})
6465

66+
clearAgentDefinitionsCache()
67+
6568
if (openInEditor) {
6669
const filePath = getNewAgentFilePath({
6770
source: wizardData.location!,

0 commit comments

Comments
 (0)