From 597fdb7a512f3cc85ece41358600b057bfd43caa Mon Sep 17 00:00:00 2001 From: ismeth Date: Thu, 19 Mar 2026 11:10:38 +0100 Subject: [PATCH] fix(switch-agent): correct selectSession call signature for TUI navigation - Fix TuiService type to match actual API: { body: { sessionID } } - Fix selectSession call arg shape (was { sessionID }, now { body: { sessionID } }) - Add logging on both TUI failure paths (service unavailable / navigation error) - Remove redundant inline idle-handling from polling path (already handled by event-based session-idle-event-handler) --- src/tools/switch-agent/tools.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 } }