mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-22 03:51:22 -07:00
feat(core, ui): Add /agents refresh command. (#16204)
This commit is contained in:
@@ -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),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user