From 595f706fd65924303ddd4443557f26201817b9f2 Mon Sep 17 00:00:00 2001 From: cpacker Date: Tue, 13 Jan 2026 18:15:53 -0800 Subject: [PATCH] fix: add conv query param to ADE links --- src/cli/App.tsx | 4 +++- src/cli/components/AgentInfoBar.tsx | 6 +++++- src/cli/components/InputAssist.tsx | 3 +++ src/cli/components/InputRich.tsx | 3 +++ src/cli/components/MemoryViewer.tsx | 4 +++- src/cli/helpers/errorFormatter.ts | 19 ++++++++++++++----- 6 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/cli/App.tsx b/src/cli/App.tsx index c38107a..87db7b1 100644 --- a/src/cli/App.tsx +++ b/src/cli/App.tsx @@ -3480,7 +3480,7 @@ export default function App({ // Special handling for /ade command - open agent in browser if (trimmed === "/ade") { - const adeUrl = `https://app.letta.com/agents/${agentId}`; + const adeUrl = `https://app.letta.com/agents/${agentId}?conversation=${conversationIdRef.current}`; const cmdId = uid("cmd"); // Fire-and-forget browser open @@ -7537,6 +7537,7 @@ Plan file path: ${planFilePath}`; ralphPending={pendingRalphConfig !== null} ralphPendingYolo={pendingRalphConfig?.isYolo ?? false} onRalphExit={handleRalphExit} + conversationId={conversationId} /> @@ -7845,6 +7846,7 @@ Plan file path: ${planFilePath}`; agentId={agentId} agentName={agentName} onClose={closeOverlay} + conversationId={conversationId} /> )} diff --git a/src/cli/components/AgentInfoBar.tsx b/src/cli/components/AgentInfoBar.tsx index 4c9bf7c..ba10434 100644 --- a/src/cli/components/AgentInfoBar.tsx +++ b/src/cli/components/AgentInfoBar.tsx @@ -9,6 +9,7 @@ interface AgentInfoBarProps { agentId?: string; agentName?: string | null; serverUrl?: string; + conversationId?: string; } /** @@ -18,6 +19,7 @@ export const AgentInfoBar = memo(function AgentInfoBar({ agentId, agentName, serverUrl, + conversationId, }: AgentInfoBarProps) { // Check if current agent is pinned const isPinned = useMemo(() => { @@ -54,7 +56,9 @@ export const AgentInfoBar = memo(function AgentInfoBar({ {isCloudUser && ( - + Open in ADE ↗ )} diff --git a/src/cli/components/InputAssist.tsx b/src/cli/components/InputAssist.tsx index e52212f..3df0d62 100644 --- a/src/cli/components/InputAssist.tsx +++ b/src/cli/components/InputAssist.tsx @@ -15,6 +15,7 @@ interface InputAssistProps { agentName?: string | null; serverUrl?: string; workingDirectory?: string; + conversationId?: string; } /** @@ -34,6 +35,7 @@ export function InputAssist({ agentName, serverUrl, workingDirectory, + conversationId, }: InputAssistProps) { const showFileAutocomplete = currentInput.includes("@"); const showCommandAutocomplete = @@ -79,6 +81,7 @@ export function InputAssist({ agentId={agentId} agentName={agentName} serverUrl={serverUrl} + conversationId={conversationId} /> ); diff --git a/src/cli/components/InputRich.tsx b/src/cli/components/InputRich.tsx index ccc0a20..d5466cf 100644 --- a/src/cli/components/InputRich.tsx +++ b/src/cli/components/InputRich.tsx @@ -131,6 +131,7 @@ export function Input({ ralphPending = false, ralphPendingYolo = false, onRalphExit, + conversationId, }: { visible?: boolean; streaming: boolean; @@ -154,6 +155,7 @@ export function Input({ ralphPending?: boolean; ralphPendingYolo?: boolean; onRalphExit?: () => void; + conversationId?: string; }) { const [value, setValue] = useState(""); const [escapePressed, setEscapePressed] = useState(false); @@ -824,6 +826,7 @@ export function Input({ agentName={agentName} serverUrl={serverUrl} workingDirectory={process.cwd()} + conversationId={conversationId} /> void; + conversationId?: string; } /** @@ -39,9 +40,10 @@ export function MemoryViewer({ agentId, agentName, onClose, + conversationId, }: MemoryViewerProps) { // Construct ADE URL for this agent's memory - const adeUrl = `https://app.letta.com/agents/${agentId}?view=memory`; + const adeUrl = `https://app.letta.com/agents/${agentId}?view=memory${conversationId ? `&conversation=${conversationId}` : ""}`; const [selectedIndex, setSelectedIndex] = useState(0); const [currentPage, setCurrentPage] = useState(0); diff --git a/src/cli/helpers/errorFormatter.ts b/src/cli/helpers/errorFormatter.ts index 861f8bb..89164fa 100644 --- a/src/cli/helpers/errorFormatter.ts +++ b/src/cli/helpers/errorFormatter.ts @@ -42,8 +42,13 @@ function isCreditExhaustedError(e: APIError): boolean { * Handles APIError, Error, and other error types consistently * @param e The error object to format * @param agentId Optional agent ID to create hyperlinks to the Letta dashboard + * @param conversationId Optional conversation ID to include in agent links */ -export function formatErrorDetails(e: unknown, agentId?: string): string { +export function formatErrorDetails( + e: unknown, + agentId?: string, + conversationId?: string, +): string { let runId: string | undefined; // Handle APIError from streaming (event: error) @@ -71,7 +76,7 @@ export function formatErrorDetails(e: unknown, agentId?: string): string { const baseError = `${errorType}${message}${errorDetail}`; return runId && agentId - ? `${baseError}\n${createAgentLink(runId, agentId)}` + ? `${baseError}\n${createAgentLink(runId, agentId, conversationId)}` : baseError; } } @@ -85,7 +90,7 @@ export function formatErrorDetails(e: unknown, agentId?: string): string { const baseError = detail ? `${e.message}\nDetail: ${detail}` : e.message; return runId && agentId - ? `${baseError}\n${createAgentLink(runId, agentId)}` + ? `${baseError}\n${createAgentLink(runId, agentId, conversationId)}` : baseError; } @@ -127,7 +132,11 @@ export function formatErrorDetails(e: unknown, agentId?: string): string { /** * Create a terminal hyperlink to the agent with run ID displayed */ -function createAgentLink(runId: string, agentId: string): string { - const url = `https://app.letta.com/agents/${agentId}`; +function createAgentLink( + runId: string, + agentId: string, + conversationId?: string, +): string { + const url = `https://app.letta.com/agents/${agentId}${conversationId ? `?conversation=${conversationId}` : ""}`; return `View agent: \x1b]8;;${url}\x1b\\${agentId}\x1b]8;;\x1b\\ (run: ${runId})`; }