From 34eb87b014d2747c6ca1c0e8a15c62c4f7b87e13 Mon Sep 17 00:00:00 2001 From: Kian Jones <11655409+kianjones9@users.noreply.github.com> Date: Tue, 16 Dec 2025 14:52:28 -0500 Subject: [PATCH] chore: soft deprecate unlink and link (#239) --- src/cli/App.tsx | 90 ++++++++++++++++++++++++++++++++++++ src/cli/commands/registry.ts | 16 +++++++ 2 files changed, 106 insertions(+) diff --git a/src/cli/App.tsx b/src/cli/App.tsx index 739a01d..8160900 100644 --- a/src/cli/App.tsx +++ b/src/cli/App.tsx @@ -2026,6 +2026,96 @@ export default function App({ return { submitted: true }; } + // Special handling for /link command - attach all Letta Code tools (deprecated) + if (msg.trim() === "/link" || msg.trim().startsWith("/link ")) { + const cmdId = uid("cmd"); + buffersRef.current.byId.set(cmdId, { + kind: "command", + id: cmdId, + input: msg, + output: "Attaching Letta Code tools...", + phase: "running", + }); + buffersRef.current.order.push(cmdId); + refreshDerived(); + + setCommandRunning(true); + + try { + const { linkToolsToAgent } = await import("../agent/modify"); + const result = await linkToolsToAgent(agentId); + + buffersRef.current.byId.set(cmdId, { + kind: "command", + id: cmdId, + input: msg, + output: result.message, + phase: "finished", + success: result.success, + }); + refreshDerived(); + } catch (error) { + const errorDetails = formatErrorDetails(error, agentId); + buffersRef.current.byId.set(cmdId, { + kind: "command", + id: cmdId, + input: msg, + output: `Failed to link tools: ${errorDetails}`, + phase: "finished", + success: false, + }); + refreshDerived(); + } finally { + setCommandRunning(false); + } + return { submitted: true }; + } + + // Special handling for /unlink command - remove all Letta Code tools (deprecated) + if (msg.trim() === "/unlink" || msg.trim().startsWith("/unlink ")) { + const cmdId = uid("cmd"); + buffersRef.current.byId.set(cmdId, { + kind: "command", + id: cmdId, + input: msg, + output: "Removing Letta Code tools...", + phase: "running", + }); + buffersRef.current.order.push(cmdId); + refreshDerived(); + + setCommandRunning(true); + + try { + const { unlinkToolsFromAgent } = await import("../agent/modify"); + const result = await unlinkToolsFromAgent(agentId); + + buffersRef.current.byId.set(cmdId, { + kind: "command", + id: cmdId, + input: msg, + output: result.message, + phase: "finished", + success: result.success, + }); + refreshDerived(); + } catch (error) { + const errorDetails = formatErrorDetails(error, agentId); + buffersRef.current.byId.set(cmdId, { + kind: "command", + id: cmdId, + input: msg, + output: `Failed to unlink tools: ${errorDetails}`, + phase: "finished", + success: false, + }); + refreshDerived(); + } finally { + setCommandRunning(false); + } + return { submitted: true }; + } + // Special handling for /bg command - show background shell processes if (msg.trim() === "/bg") { const { backgroundProcesses } = await import( diff --git a/src/cli/commands/registry.ts b/src/cli/commands/registry.ts index 6f2fce2..b4625bd 100644 --- a/src/cli/commands/registry.ts +++ b/src/cli/commands/registry.ts @@ -59,6 +59,22 @@ export const commands: Record = { return "Updating description..."; }, }, + "/link": { + desc: "Attach all Letta Code tools to agent (deprecated, use /toolset instead)", + hidden: true, + handler: () => { + // Handled specially in App.tsx to access agent ID and client + return "Linking tools..."; + }, + }, + "/unlink": { + desc: "Remove all Letta Code tools from agent (deprecated, use /toolset instead)", + hidden: true, + handler: () => { + // Handled specially in App.tsx to access agent ID and client + return "Unlinking tools..."; + }, + }, "/toolset": { desc: "Switch toolset (replaces /link and /unlink)", handler: () => {