hermes-agent/apps/desktop/electron/profile-session-routing.ts
2026-07-27 13:41:56 -05:00

19 lines
600 B
TypeScript

export interface ProfileSessionsResponse {
sessions: unknown[]
total: number
profile_totals: Record<string, number>
[key: string]: unknown
}
type FetchJsonForProfile = (profile: string | null, path: string) => Promise<unknown>
export async function fetchPrimaryProfileSessions(
searchParams: URLSearchParams,
fetchJsonForProfile: FetchJsonForProfile
): Promise<ProfileSessionsResponse> {
try {
return (await fetchJsonForProfile(null, `/api/profiles/sessions?${searchParams}`)) as ProfileSessionsResponse
} catch {
return { sessions: [], total: 0, profile_totals: {} }
}
}