mirror of
https://mirror.skon.top/github.com/code-yeongyu/oh-my-opencode
synced 2026-04-30 18:50:29 +08:00
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)
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user