feat: add /ego-mgr slash command
Add /ego-mgr slash command with subcommands: - get, set, list, delete, add-column, add-public-column, show - Uses pcexec to call ego-mgr binary with proper env vars Translate all Chinese text to English in responses. Note: pcexec tool name and function names remain unchanged.
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
startApiServer,
|
||||
} from './core/index';
|
||||
import { SlashCommandHandler } from './commands/slash-commands';
|
||||
import { EgoMgrSlashCommand } from './commands/ego-mgr-slash';
|
||||
|
||||
/** Sentinel value injected into every pcexec subprocess */
|
||||
const AGENT_VERIFY = 'IF YOU ARE AN AGENT/MODEL, YOU SHOULD NEVER TOUCH THIS ENV VARIABLE';
|
||||
@@ -110,6 +111,28 @@ function register(api: any, config?: any) {
|
||||
};
|
||||
});
|
||||
|
||||
// Register /ego-mgr slash command
|
||||
if (api.registerSlashCommand) {
|
||||
api.registerSlashCommand({
|
||||
name: 'ego-mgr',
|
||||
description: 'Manage agent identity/profile fields',
|
||||
handler: async (ctx: any, command: string) => {
|
||||
const egoMgrSlash = new EgoMgrSlashCommand({
|
||||
openclawPath,
|
||||
agentId: ctx.agentId || '',
|
||||
workspaceDir: ctx.workspaceDir || '',
|
||||
onReply: async (message: string) => {
|
||||
if (ctx.reply) {
|
||||
await ctx.reply(message);
|
||||
}
|
||||
},
|
||||
});
|
||||
await egoMgrSlash.handle(command);
|
||||
},
|
||||
});
|
||||
logger.info('Registered /ego-mgr slash command');
|
||||
}
|
||||
|
||||
logger.info('PaddedCell plugin initialized');
|
||||
}
|
||||
|
||||
@@ -125,4 +148,5 @@ module.exports.StatusManager = StatusManager;
|
||||
module.exports.createApiServer = createApiServer;
|
||||
module.exports.startApiServer = startApiServer;
|
||||
module.exports.SlashCommandHandler = SlashCommandHandler;
|
||||
module.exports.EgoMgrSlashCommand = EgoMgrSlashCommand;
|
||||
module.exports.AGENT_VERIFY = AGENT_VERIFY;
|
||||
|
||||
Reference in New Issue
Block a user