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

View File

@@ -8,8 +8,8 @@ import type { SlashCommand, CommandContext } from './types.js';
import { CommandKind } from './types.js';
import { MessageType, type HistoryItemAgentsList } from '../types.js';
export const agentsCommand: SlashCommand = {
name: 'agents',
const agentsListCommand: SlashCommand = {
name: 'list',
description: 'List available local and remote agents',
kind: CommandKind.BUILT_IN,
autoExecute: true,
@@ -49,3 +49,38 @@ export const agentsCommand: SlashCommand = {
return;
},
};
const agentsRefreshCommand: SlashCommand = {
name: 'refresh',
description: 'Reload the agent registry',
kind: CommandKind.BUILT_IN,
action: async (context: CommandContext) => {
const { config } = context.services;
const agentRegistry = config?.getAgentRegistry();
if (!agentRegistry) {
return {
type: 'message',
messageType: 'error',
content: 'Agent registry not found.',
};
}
await agentRegistry.reload();
return {
type: 'message',
messageType: 'info',
content: 'Agents refreshed successfully.',
};
},
};
export const agentsCommand: SlashCommand = {
name: 'agents',
description: 'Manage agents',
kind: CommandKind.BUILT_IN,
subCommands: [agentsListCommand, agentsRefreshCommand],
action: async (context: CommandContext, args) =>
// Default to list if no subcommand is provided
agentsListCommand.action!(context, args),
};