Add !persona command to overseer

This commit is contained in:
2026-04-07 17:43:39 +00:00
parent d3ed3619c2
commit 590c88ecef

View File

@@ -195,8 +195,45 @@ export async function runOverseer(config: OverseerConfig) {
break;
}
case "!persona": {
const name = parts[1];
if (!name) {
bot.say(event.target, "Usage: !persona <name> [new persona text]");
return;
}
const newPersona = parts.slice(2).join(" ");
if (newPersona) {
await reloadAgent(name, { persona: newPersona });
bot.say(event.target, `Agent "${name}" persona updated.`);
} else {
// View current persona — read from agent config via SSH
const agents = listAgents();
const agent = agents.find((a) => a.name === name);
if (!agent) {
bot.say(event.target, `Agent "${name}" not found.`);
return;
}
try {
const { execFileSync } = await import("node:child_process");
const { sshKeyPath } = (await import("./config.js")).CONFIG;
const persona = execFileSync("ssh", [
"-o", "StrictHostKeyChecking=no",
"-o", "UserKnownHostsFile=/dev/null",
"-o", "ConnectTimeout=3",
"-i", sshKeyPath,
`root@${agent.ip}`,
"cat /etc/agent/persona.md",
], { encoding: "utf-8", timeout: 5_000 }).trim();
bot.say(event.target, `${name}: ${persona}`);
} catch {
bot.say(event.target, `Could not read persona for "${name}".`);
}
}
break;
}
case "!help": {
bot.say(event.target, "Commands: !invoke <template> [name] | !destroy <name> | !list | !model <name> <model> | !models | !templates | !status | !help");
bot.say(event.target, "Commands: !invoke <template> [name] | !destroy <name> | !list | !model <name> <model> | !models | !templates | !persona <name> [text] | !status | !help");
break;
}
}