Adds a first-run Desktop choice between installing Hermes locally and connecting to an existing remote Hermes gateway. The choice appears after backend resolution but before ensureRuntime(), so selecting remote cannot accidentally trigger local bootstrap. New modules: - first-run-setup-gate: concurrent first-run decision gate and reset semantics - primary-backend-startup: Electron-free orchestration seam (saved remote resolution, gate decision, remote re-resolution, local continuation) - primary-connection-rehome: prevents dual-owner race where both cold boot() and renderer softSwitch() could connect simultaneously - first-run-remote-form: extracted remote form with stale-result guards Reuses existing connection-config IPC, encrypted token storage, OAuth session partition, and primary backend resolution. Fixes #38602 Fixes #36970
27 lines
710 B
TypeScript
27 lines
710 B
TypeScript
import type { DesktopAuthProvider } from '@/global'
|
|
|
|
export interface RemoteAuthProviderShape {
|
|
isPassword: boolean
|
|
providerLabel: string
|
|
}
|
|
|
|
function providerDisplayName(provider: DesktopAuthProvider): string {
|
|
return provider.displayName || provider.name
|
|
}
|
|
|
|
export function deriveRemoteAuthProviderShape(
|
|
providers: DesktopAuthProvider[] | null | undefined,
|
|
fallback = 'your identity provider'
|
|
): RemoteAuthProviderShape {
|
|
const list = providers ?? []
|
|
|
|
if (list.length === 0) {
|
|
return { isPassword: false, providerLabel: fallback }
|
|
}
|
|
|
|
return {
|
|
isPassword: list.every(provider => Boolean(provider.supportsPassword)),
|
|
providerLabel: list.map(providerDisplayName).join(' / ')
|
|
}
|
|
}
|