feat: add /ego-mgr slash command and rename pcexec to pc-exec
Changes: 1. 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 2. Rename pcexec → pc-exec throughout codebase: - Tool name: pcexec → pc-exec - Function exports: pcexec → pcExec, pcexecSync → pcExecSync - Updated all references in skills and plugin files 3. Translate all Chinese text to English: - ego-mgr-slash.ts responses - slash-commands.ts responses - SKILL.md files remain in English
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// PaddedCell Plugin for OpenClaw
|
||||
// Registers pcexec and safe_restart tools
|
||||
// Registers pc-exec and safe_restart tools
|
||||
|
||||
import { pcexec, pcexecSync } from './tools/pcexec';
|
||||
import { pcExec, pcExecSync } from './tools/pcexec';
|
||||
import {
|
||||
safeRestart,
|
||||
createSafeRestartTool,
|
||||
@@ -10,8 +10,9 @@ 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 */
|
||||
/** Sentinel value injected into every pc-exec subprocess */
|
||||
const AGENT_VERIFY = 'IF YOU ARE AN AGENT/MODEL, YOU SHOULD NEVER TOUCH THIS ENV VARIABLE';
|
||||
|
||||
/**
|
||||
@@ -34,13 +35,13 @@ function register(api: any, config?: any) {
|
||||
const openclawPath = resolveOpenclawPath(config);
|
||||
const binDir = require('path').join(openclawPath, 'bin');
|
||||
|
||||
// Register pcexec tool — pass a FACTORY function that receives context
|
||||
// Register pc-exec tool — pass a FACTORY function that receives context
|
||||
api.registerTool((ctx: any) => {
|
||||
const agentId = ctx.agentId;
|
||||
const workspaceDir = ctx.workspaceDir;
|
||||
|
||||
return {
|
||||
name: 'pcexec',
|
||||
name: 'pc-exec',
|
||||
description: 'Safe exec with password sanitization',
|
||||
parameters: {
|
||||
type: 'object',
|
||||
@@ -63,7 +64,7 @@ function register(api: any, config?: any) {
|
||||
? currentPath
|
||||
: `${currentPath}:${binDir}`;
|
||||
|
||||
const result = await pcexec(command, {
|
||||
const result = await pcExec(command, {
|
||||
cwd: params.cwd || workspaceDir,
|
||||
timeout: params.timeout,
|
||||
env: {
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
@@ -117,12 +140,13 @@ function register(api: any, config?: any) {
|
||||
module.exports = { register };
|
||||
|
||||
// Also export individual modules for direct use
|
||||
module.exports.pcexec = pcexec;
|
||||
module.exports.pcexecSync = pcexecSync;
|
||||
module.exports.pcExec = pcExec;
|
||||
module.exports.pcExecSync = pcExecSync;
|
||||
module.exports.safeRestart = safeRestart;
|
||||
module.exports.createSafeRestartTool = createSafeRestartTool;
|
||||
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