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)
This commit is contained in:
ismeth
2026-03-19 11:10:38 +01:00
committed by YeonGyu-Kim
parent 6e5c5043f6
commit 597fdb7a51

View File

@@ -13,7 +13,7 @@ const DESCRIPTION =
const ALLOWED_AGENTS = new Set<string>(SWITCHABLE_AGENT_NAMES)
type TuiService = {
selectSession: (input?: { sessionID?: string }) => Promise<unknown>
selectSession: (input: { body: { sessionID: string } }) => Promise<unknown>
}
type SessionClient = {
@@ -58,12 +58,14 @@ function hasTuiService(client: SessionClient): client is SessionClient & { tui:
async function navigateTuiToSession(client: SessionClient, sessionID: string): Promise<boolean> {
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
}
}