diff --git a/src/cli/App.tsx b/src/cli/App.tsx index b0b5efc..da17547 100644 --- a/src/cli/App.tsx +++ b/src/cli/App.tsx @@ -7858,6 +7858,49 @@ export default function App({ return { submitted: true }; } + // Special handling for /recompile command - recompile agent + current conversation + if (trimmed === "/recompile") { + const cmd = commandRunner.start( + trimmed, + "Recompiling agent and conversation...", + ); + + setCommandRunning(true); + + try { + const client = await getClient(); + const currentConversationId = conversationIdRef.current; + + await client.agents.recompile(agentId, { + update_timestamp: true, + }); + + const conversationParams = + currentConversationId === "default" + ? { agent_id: agentId } + : undefined; + await client.conversations.recompile( + currentConversationId, + conversationParams, + ); + + cmd.finish( + [ + "Recompiled current agent and conversation.", + "(warning: this will evict the cache and increase costs)", + ].join("\n"), + true, + ); + } catch (error) { + const errorDetails = formatErrorDetails(error, agentId); + cmd.fail(`Failed: ${errorDetails}`); + } finally { + setCommandRunning(false); + } + + return { submitted: true }; + } + // Special handling for /exit command - exit without stats if (trimmed === "/exit") { const cmd = commandRunner.start(trimmed, "See ya!"); diff --git a/src/cli/commands/registry.ts b/src/cli/commands/registry.ts index 531f9ab..7382c62 100644 --- a/src/cli/commands/registry.ts +++ b/src/cli/commands/registry.ts @@ -270,6 +270,15 @@ export const commands: Record = { return "Fetching context usage..."; }, }, + "/recompile": { + desc: "Recompile current agent + conversation (warning: this will evict the cache and increase costs)", + order: 33.6, + noArgs: true, + handler: () => { + // Handled specially in App.tsx + return "Recompiling agent and conversation..."; + }, + }, "/feedback": { desc: "Send feedback to the Letta team", order: 34,