Skip to content

The agent that grows with you

docs(desktop): document profile scope helpers

David Dudok de Wit8477a5a83dfa
diff --git a/apps/desktop/electron/profile-session-routing.ts b/apps/desktop/electron/profile-session-routing.ts
index 3af1bd95a6e..29b20e3a4c7 100644
--- a/apps/desktop/electron/profile-session-routing.ts
+++ b/apps/desktop/electron/profile-session-routing.ts
@@ -118,6 +118,7 @@ export function buildSidebarSessionSliceParams(searchParams: URLSearchParams): S
}
}
+/** Fetch the primary backend's profile-aware session slice, falling back to an empty result when unavailable. */
export async function fetchPrimaryProfileSessions(
searchParams: URLSearchParams,
fetchJsonForProfile: FetchJsonForProfile
diff --git a/apps/desktop/src/app/chat/sidebar/profile-scope.ts b/apps/desktop/src/app/chat/sidebar/profile-scope.ts
index 1e59fe37436..45686d82525 100644
--- a/apps/desktop/src/app/chat/sidebar/profile-scope.ts
+++ b/apps/desktop/src/app/chat/sidebar/profile-scope.ts
@@ -1,6 +1,7 @@
import { ALL_PROFILES, normalizeProfileKey } from '@/store/profile'
import type { SessionInfo } from '@/types/hermes'
+/** Return the sessions visible in one sidebar profile scope, or the original unified list for All profiles. */
export function filterSessionsByProfileScope(sessions: SessionInfo[], profileScope: string): SessionInfo[] {
if (profileScope === ALL_PROFILES) {
return sessions
diff --git a/apps/desktop/src/store/profile.ts b/apps/desktop/src/store/profile.ts
index d0fd760b509..09b0b29cbf0 100644
--- a/apps/desktop/src/store/profile.ts
+++ b/apps/desktop/src/store/profile.ts
@@ -315,11 +315,11 @@ export async function ensureGatewayProfile(profile: string | null | undefined):
export const ALL_PROFILES = '__all__'
-// Messaging totals belong to the Desktop profile route as well as the source.
-// Shared by the fetcher and sidebar so neither can read another profile's count.
+/** Normalize a sidebar scope to the profile key used by messaging session queries. */
export const messagingProfileFor = (profileScope: string): string =>
profileScope === ALL_PROFILES ? 'all' : normalizeProfileKey(profileScope)
+/** Key a platform total by its Desktop profile route so counts cannot leak across profiles. */
export const messagingTotalsKey = (messagingProfile: string, sourceId: string): string =>
`${messagingProfile}:${sourceId}`