The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(webapp): one helper names the served profile, else default
unsupportedpastels8e657b956c33
diff --git a/apps/desktop/src/lib/browser-connection.ts b/apps/desktop/src/lib/browser-connection.tsindex c879debf41c..fa880424ec3 100644--- a/apps/desktop/src/lib/browser-connection.ts+++ b/apps/desktop/src/lib/browser-connection.ts@@ -11,7 +11,7 @@ import {navigateToBrowserLogin,ticketedWebsocketUrl} from '@/lib/browser-transport'-import { browserLaunchProfile } from '@/lib/platform'+import { browserLaunchProfileOrDefault } from '@/lib/platform'/** The serving origin is the only connection a browser-hosted Desktop has. */export function requireBrowserConnection(connectionId?: null | string): void {@@ -27,7 +27,7 @@ export function requireBrowserConnection(connectionId?: null | string): void {function ridesWithProfile(profile?: null | string): boolean {const name = profile?.trim()- return Boolean(name) && name !== (browserLaunchProfile() || 'default')+ return Boolean(name) && name !== browserLaunchProfileOrDefault()}function connectionFor(bootstrap: BrowserBootstrap, profile?: null | string): HermesConnection {diff --git a/apps/desktop/src/lib/browser-settings.ts b/apps/desktop/src/lib/browser-settings.tsindex a5a3c37f8fc..5ef497c5de9 100644--- a/apps/desktop/src/lib/browser-settings.ts+++ b/apps/desktop/src/lib/browser-settings.ts@@ -1,6 +1,6 @@import { normalizeBasePath } from '@hermes/shared'-import { type BrowserHostGlobals, browserLaunchProfile } from './platform'+import { type BrowserHostGlobals, browserLaunchProfileOrDefault } from './platform'import { readKey, writeKey } from './storage'interface BrowserSettingsOptions {@@ -16,7 +16,7 @@ export function browserPageBasePath(): string {/** A profile not named is the one the serving gateway runs as, the profile its* REST answers for when a request names none. */export function browserDefaultProjectDirKey(basePath: string, profile: string): string {- const owner = profile.trim() || browserLaunchProfile() || 'default'+ const owner = profile.trim() || browserLaunchProfileOrDefault()return `hermes:browser:default-project-dir:${JSON.stringify([basePath || '/', owner])}`}@@ -38,9 +38,9 @@ function adoptLegacyLaunchFolder(basePath: string): void {return}- const launch = browserLaunchProfile()+ const launch = browserLaunchProfileOrDefault()- if (launch && launch !== 'default') {+ if (launch !== 'default') {const ownKey = browserDefaultProjectDirKey(basePath, launch)const legacy = readKey(browserDefaultProjectDirKey(basePath, 'default'))?.trim()diff --git a/apps/desktop/src/lib/platform.ts b/apps/desktop/src/lib/platform.tsindex 5179f1ccfaf..5c1339ae32e 100644--- a/apps/desktop/src/lib/platform.ts+++ b/apps/desktop/src/lib/platform.ts@@ -38,6 +38,11 @@ export function browserLaunchProfile(): string {return String((window as Window & BrowserHostGlobals).__HERMES_DASHBOARD_PROFILE__ ?? '').trim()}+/** The profile a request that names none reaches: the one the server runs as, else `default`. */+export function browserLaunchProfileOrDefault(): string {+ return browserLaunchProfile() || 'default'+}+/*** The server served this page as the browser-hosted Desktop: a gated host* (cookie auth) or the Webapp surface (its session arrives by launch link).