Skip to content

The agent that grows with you

fix(desktop): local models on in bundles branch

ethernet01dfbe87074a
diff --git a/apps/desktop/electron/feature-flags.ts b/apps/desktop/electron/feature-flags.ts
index 22b3731abf0..9a23e22644c 100644
--- a/apps/desktop/electron/feature-flags.ts
+++ b/apps/desktop/electron/feature-flags.ts
@@ -1,36 +1,22 @@
-// feature-flags.ts — the desktop's feature-flag resolver.
-//
-// One place that decides which gated surfaces are on for this artifact.
-// Flags resolve from two inputs:
-// - launch argv (e.g. `--local` on Hermes.exe, or `hermes desktop --local`)
-// - the release channel of the artifact (canary builds preview features)
-// The verdict is static for the process lifetime; the renderer reads it
-// once via the preload bridge (`hermes:feature-flags`).
-
-export interface FeatureFlags {
+const featureFlags = {
/** Local-models GUI surfaces (settings pane, pickers, statusbar, tips). */
- localModels: boolean
-}
+ localModels: ({ argv }) =>
+ process.platform === 'win32' || process.platform === 'darwin' || argv.includes('--local')
+} satisfies Record<string, (args: FeatureFlagInput) => boolean>
+
+export type FeatureFlags = { [K in keyof typeof featureFlags]: boolean }
-/** True when a baked install tag names a canary-channel build. */
export function isCanaryTag(tag: string | null | undefined): boolean {
return /-canary\./.test(tag || '')
}
export interface FeatureFlagInput {
- /** The main process argv (launch flags like `--local`). */
+ /** desktop launch flags */
argv: readonly string[]
/** Whether this artifact is a canary-channel build. */
canary: boolean
}
-/**
- * Resolve every feature flag for this process. A flag is on when the launch
- * argv opts in (`--local`) OR the artifact is a canary build — canary is the
- * preview channel, so gated features ride along by default there.
- */
-export function resolveFeatureFlags({ argv, canary }: FeatureFlagInput): FeatureFlags {
- return {
- localModels: canary || argv.includes('--local')
- }
+export function resolveFeatureFlags(input: FeatureFlagInput): FeatureFlags {
+ return Object.fromEntries(Object.entries(featureFlags).map(([k, v]) => [k, v(input)])) as FeatureFlags
}
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts
index d65896101fc..1cb25991328 100644
--- a/apps/desktop/electron/main.ts
+++ b/apps/desktop/electron/main.ts
@@ -827,7 +827,7 @@ const DESKTOP_LOG_BUFFER_MAX_CHARS = 64 * 1024
const DESKTOP_LOG_MAX_BYTES = 10 * 1024 * 1024
const DESKTOP_LOG_BACKUP_COUNT = 3
const DESKTOP_LOG_DISCARD_BYTES = DESKTOP_LOG_MAX_BYTES * 4
-const desktopLogBackupPath = n => `${DESKTOP_LOG_PATH}.${n}`
+const desktopLogBackupPath = (n: string) => `${DESKTOP_LOG_PATH}.${n}`
const BOOT_FAKE_MODE = process.env.HERMES_DESKTOP_BOOT_FAKE === '1'
const BOOT_FAKE_ERROR = process.env.HERMES_DESKTOP_BOOT_FAKE_ERROR || ''
// Automated teardown (Playwright's app.close(), harness scripts) quits with