Compare commits

...

1 Commits

Author SHA1 Message Date
Timothy 019501335d feat: HIVE_DESKTOP_MODE env to skip frontend build in hive serve
When `hive serve` is launched from a desktop shell (Electron), the
client ships its own UI and the bundled environment usually has no
`npm` toolchain. Building the React frontend fails noisily and isn't
needed.

Setting `HIVE_DESKTOP_MODE=1` in the spawn env now short-circuits
`_build_frontend()` cleanly. The flag also serves as a hook for
future desktop-vs-server branching (single-user mode, telemetry,
etc.) without needing a new env var each time.

Default (unset) preserves today's behavior — no change for server
deployments.
2026-04-26 13:38:59 -07:00
2 changed files with 17 additions and 1 deletions
+10
View File
@@ -14,6 +14,16 @@ from typing import Any
DEFAULT_MAX_TOKENS = 8192
# ---------------------------------------------------------------------------
# Desktop mode
# ---------------------------------------------------------------------------
# Set by the Electron shell when it spawns `hive serve` so the runtime knows
# it's hosted inside a desktop client rather than served standalone. Today
# this only gates the frontend-build step in `hive serve` (the desktop ships
# its own renderer), but it's also a useful hook for future single-user /
# telemetry-off branching.
DESKTOP_MODE: bool = bool(os.environ.get("HIVE_DESKTOP_MODE"))
# ---------------------------------------------------------------------------
# Hive home directory structure
# ---------------------------------------------------------------------------
+7 -1
View File
@@ -92,7 +92,13 @@ def cmd_serve(args: argparse.Namespace) -> int:
from aiohttp import web
_build_frontend()
from framework.config import DESKTOP_MODE
# Skip frontend build when running inside the desktop shell — Electron
# ships its own renderer, and running `npm` from a packaged install
# often fails (no toolchain on the user's machine).
if not DESKTOP_MODE:
_build_frontend()
from framework.observability import configure_logging
from framework.server.app import create_app