feat(ui): surface retrying session status
Preserve retry metadata from session.status events so the session list and header can show a live retry countdown with context. Notify users when a session enters retry and reuse the existing error styling so retrying feels actionable without losing the current badge layout.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { Session, SessionStatus } from "../types/session"
|
||||
import type { Session, SessionRetryState, SessionStatus } from "../types/session"
|
||||
import { getInstanceSessionIndicatorStatusCached, sessions } from "./session-state"
|
||||
|
||||
function getSession(instanceId: string, sessionId: string): Session | null {
|
||||
@@ -14,6 +14,15 @@ export function getSessionStatus(instanceId: string, sessionId: string): Session
|
||||
return session.status ?? "idle"
|
||||
}
|
||||
|
||||
export function getSessionRetry(instanceId: string, sessionId: string): SessionRetryState | null {
|
||||
const session = getSession(instanceId, sessionId)
|
||||
return session?.retry ?? null
|
||||
}
|
||||
|
||||
export function getRetrySeconds(next: number, now = Date.now()): number {
|
||||
return Math.max(0, Math.round((next - now) / 1000))
|
||||
}
|
||||
|
||||
export type InstanceSessionIndicatorStatus = "permission" | SessionStatus
|
||||
|
||||
export function getInstanceSessionIndicatorStatus(instanceId: string): InstanceSessionIndicatorStatus {
|
||||
|
||||
Reference in New Issue
Block a user