feat: add /description command to update agent description (#193)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2025-12-12 15:06:08 -08:00
committed by GitHub
parent 7e8bc50f68
commit 226d20fbae
2 changed files with 72 additions and 0 deletions

View File

@@ -1501,6 +1501,71 @@ export default function App({
return { submitted: true };
}
// Special handling for /description command - update agent description
if (msg.trim().startsWith("/description")) {
const parts = msg.trim().split(/\s+/);
const newDescription = parts.slice(1).join(" ");
if (!newDescription) {
const cmdId = uid("cmd");
buffersRef.current.byId.set(cmdId, {
kind: "command",
id: cmdId,
input: msg,
output: "Please provide a description: /description <text>",
phase: "finished",
success: false,
});
buffersRef.current.order.push(cmdId);
refreshDerived();
return { submitted: true };
}
const cmdId = uid("cmd");
buffersRef.current.byId.set(cmdId, {
kind: "command",
id: cmdId,
input: msg,
output: "Updating description...",
phase: "running",
});
buffersRef.current.order.push(cmdId);
refreshDerived();
setCommandRunning(true);
try {
const client = await getClient();
await client.agents.update(agentId, {
description: newDescription,
});
buffersRef.current.byId.set(cmdId, {
kind: "command",
id: cmdId,
input: msg,
output: `Description updated to "${newDescription}"`,
phase: "finished",
success: true,
});
refreshDerived();
} catch (error) {
const errorDetails = formatErrorDetails(error, agentId);
buffersRef.current.byId.set(cmdId, {
kind: "command",
id: cmdId,
input: msg,
output: `Failed: ${errorDetails}`,
phase: "finished",
success: false,
});
refreshDerived();
} finally {
setCommandRunning(false);
}
return { submitted: true };
}
// Special handling for /resume command - show session resume selector
if (msg.trim() === "/resume") {
setResumeSelectorOpen(true);

View File

@@ -72,6 +72,13 @@ export const commands: Record<string, Command> = {
return "Renaming agent...";
},
},
"/description": {
desc: "Update the current agent's description",
handler: () => {
// Handled specially in App.tsx to access agent ID and client
return "Updating description...";
},
},
"/swap": {
desc: "Alias for /resume",
hidden: true, // Hidden - use /resume instead