feat(core, ui): Add /agents refresh command. (#16204)

This commit is contained in:
joshualitt
2026-01-09 09:33:59 -08:00
committed by GitHub
parent c1401682ed
commit 041463d112
7 changed files with 154 additions and 6 deletions
+17 -3
View File
@@ -46,8 +46,6 @@ export class AgentRegistry {
* Discovers and loads agents.
*/
async initialize(): Promise<void> {
this.loadBuiltInAgents();
coreEvents.on(CoreEvent.ModelChanged, () => {
this.refreshAgents().catch((e) => {
debugLogger.error(
@@ -57,6 +55,22 @@ export class AgentRegistry {
});
});
await this.loadAgents();
}
/**
* Clears the current registry and re-scans for agents.
*/
async reload(): Promise<void> {
A2AClientManager.getInstance().clearCache();
this.agents.clear();
await this.loadAgents();
coreEvents.emitAgentsRefreshed();
}
private async loadAgents(): Promise<void> {
this.loadBuiltInAgents();
if (!this.config.isAgentsEnabled()) {
return;
}
@@ -99,7 +113,7 @@ export class AgentRegistry {
if (this.config.getDebugMode()) {
debugLogger.log(
`[AgentRegistry] Initialized with ${this.agents.size} agents.`,
`[AgentRegistry] Loaded with ${this.agents.size} agents.`,
);
}
}