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:
@@ -13,7 +13,7 @@ const DESCRIPTION =
|
|||||||
const ALLOWED_AGENTS = new Set<string>(SWITCHABLE_AGENT_NAMES)
|
const ALLOWED_AGENTS = new Set<string>(SWITCHABLE_AGENT_NAMES)
|
||||||
|
|
||||||
type TuiService = {
|
type TuiService = {
|
||||||
selectSession: (input?: { sessionID?: string }) => Promise<unknown>
|
selectSession: (input: { body: { sessionID: string } }) => Promise<unknown>
|
||||||
}
|
}
|
||||||
|
|
||||||
type SessionClient = {
|
type SessionClient = {
|
||||||
@@ -58,12 +58,14 @@ function hasTuiService(client: SessionClient): client is SessionClient & { tui:
|
|||||||
|
|
||||||
async function navigateTuiToSession(client: SessionClient, sessionID: string): Promise<boolean> {
|
async function navigateTuiToSession(client: SessionClient, sessionID: string): Promise<boolean> {
|
||||||
if (!hasTuiService(client)) {
|
if (!hasTuiService(client)) {
|
||||||
|
log("[switch-agent] TUI service not available, cannot navigate to session:", sessionID)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await client.tui.selectSession({ sessionID })
|
await client.tui.selectSession({ body: { sessionID } })
|
||||||
return true
|
return true
|
||||||
} catch {
|
} catch (error) {
|
||||||
|
log("[switch-agent] TUI navigation failed for session:", { sessionID, error })
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user