diff --git a/src/tools/switch-agent/tools.ts b/src/tools/switch-agent/tools.ts index a5225f47a..6340d7980 100644 --- a/src/tools/switch-agent/tools.ts +++ b/src/tools/switch-agent/tools.ts @@ -13,7 +13,7 @@ const DESCRIPTION = const ALLOWED_AGENTS = new Set(SWITCHABLE_AGENT_NAMES) type TuiService = { - selectSession: (input?: { sessionID?: string }) => Promise + selectSession: (input: { body: { sessionID: string } }) => Promise } type SessionClient = { @@ -58,12 +58,14 @@ function hasTuiService(client: SessionClient): client is SessionClient & { tui: async function navigateTuiToSession(client: SessionClient, sessionID: string): Promise { if (!hasTuiService(client)) { + log("[switch-agent] TUI service not available, cannot navigate to session:", sessionID) return false } try { - await client.tui.selectSession({ sessionID }) + await client.tui.selectSession({ body: { sessionID } }) return true - } catch { + } catch (error) { + log("[switch-agent] TUI navigation failed for session:", { sessionID, error }) return false } }